account_payment_term.py 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. from openerp import api, fields, models
  3. from openerp.exceptions import except_orm
  4. class AccountPaymentTerm(models.Model):
  5. _inherit = 'account.payment.term'
  6. invoice_amount = fields.Float(string="Invoice Amount")
  7. amount = fields.Float(string="Amount")
  8. frequency = fields.Selection([('week','Semana(s)'), ('month','Mes(es)'), ('half_month','Quincena')], string="Frequency")
  9. @api.model
  10. def join_payment_term_lines(self, values):
  11. self.env['account.payment.term.line'].search([('payment_id','=',self.id)]).unlink()
  12. new_line = self.env['account.payment.term.line']
  13. for x in values:
  14. payment_term_line = ( {
  15. 'payment_id': x['payment_id'],
  16. 'value': x['value'],
  17. 'value_amount' : x['value_amount'],
  18. 'days' : x['days'],
  19. 'days2' : x['days2'],
  20. 'weeks' : x['weeks'],
  21. 'months' : x['months'],
  22. })
  23. new_line.create(payment_term_line)
  24. @api.one
  25. def clean_lines(self):
  26. self.env['account.payment.term.line'].search([('payment_id','=',self.id)]).unlink()