123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- from openerp import models, fields, tools, api
- import openerp.addons.decimal_precision as dp
- from datetime import datetime
- class AccountInterest(models.Model):
- _name = 'account.interest'
- name = fields.Char()
- date = fields.Date('Date', help="Fecha de operación")
- state = fields.Selection([('cancel', 'Cancelado'),('open', 'Abierto'),('paid', 'Pagado')],'Estado del pago', default="open", help="Estado")
- comment = fields.Text('Comment', help="Información adicional")
-
- customer_id = fields.Many2one('res.partner', string="customer")
-
- invoice_id = fields.Many2one('account.invoice', string='Invoice Reference', ondelete='restrict', index=True)
- reference = fields.Char(string='Invoice Reference', help="Invoice Reference")
-
- currency_id = fields.Many2one('res.currency', string="Currency", help="Moneda de la operación")
-
- lines_ids = fields.One2many('account.interest.line', 'interest_id', string='interest line')
- '''
- Create
- '''
- @api.model
- def create(self, vals):
- interest = super(AccountInterest, self).create(vals)
- interest.write({'name':("INTEREST/%06d" % (interest.id))})
- return interest
- '''
- Invoice
- '''
- class accountInvoiceInterest(models.Model):
- _inherit = 'account.invoice'
- interest_ids = fields.One2many('account.interest', 'invoice_id', string=' Account Interest')
- is_interest = fields.Boolean('Factura de interés', default=False, help="Indica si esta factura fue generado por un interés.")
- '''
- partner
- '''
- class ResPartnerInterest(models.Model):
- _inherit = 'res.partner'
- interest_ids = fields.One2many('account.interest', 'customer_id', string=' Account Interest')
- class AccountInterestLine(models.Model):
- _name = 'account.interest.line'
-
- interest_id = fields.Many2one('account.interest', string='Account Interest', ondelete='cascade', index=True, required=True)
- move_line_id = fields.Many2one('account.move.line', string="Registros del diario", help="Registros del diario")
- amount = fields.Float('amount', digits_compute=dp.get_precision('Account'), required=True, help="Monto del pago")
- amount_residual = fields.Float('amount', digits_compute=dp.get_precision('Account'), required=True, help="Monto del pago")
- amount_interest = fields.Float('amount', digits_compute=dp.get_precision('Account'), required=True, help="Monto del pago")
- date_maturity = fields.Date()
- expired_days = fields.Integer('Expired Days ')
- invoice = fields.Many2one('account.invoice', string='Invoice Reference', index=True)
- reference = fields.Char(string='Invoice Reference', help="Invoice Reference")
- state = fields.Selection([('cancel','Cancelado'),('open','Abierto'),('invoiced','Facturado')],'Estado del pago', default="open")
- amount_dicount = fields.Float('amount disconut', digits_compute=dp.get_precision('Account'), help="Monto del descuento")
- '''
- Move Line
- '''
- class accountMoveLineInterest(models.Model):
- _inherit = 'account.move.line'
- interest_line_ids = fields.One2many('account.interest.line', 'move_line_id', string=' Account Interest Line')
- date_interest = fields.Date("Date interés", help="Fecha de la facturación de os interés")
|