# -*- coding: utf-8 -*- from openerp import api, fields, models from openerp.exceptions import except_orm class AccountPaymentTerm(models.Model): _inherit = 'account.payment.term' invoice_amount = fields.Float(string="Invoice Amount") amount = fields.Float(string="Amount") frequency = fields.Selection([('week','Semana(s)'), ('month','Mes(es)'), ('half_month','Quincena')], string="Frequency") @api.model def join_payment_term_lines(self, values): self.env['account.payment.term.line'].search([('payment_id','=',self.id)]).unlink() new_line = self.env['account.payment.term.line'] for x in values: payment_term_line = ( { 'payment_id': x['payment_id'], 'value': x['value'], 'value_amount' : x['value_amount'], 'days' : x['days'], 'days2' : x['days2'], 'weeks' : x['weeks'], 'months' : x['months'], }) new_line.create(payment_term_line) @api.one def clean_lines(self): self.env['account.payment.term.line'].search([('payment_id','=',self.id)]).unlink()