account_sale_term.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, tools, api
  3. import openerp.addons.decimal_precision as dp
  4. class AccountSaleTerm(models.Model):
  5. _name = 'account.sale.term'
  6. '''Sale Interest '''
  7. sale_amount = fields.Float('Amount Sale', digits_compute=dp.get_precision('Account'), default=0.0) ## Valor de la Venta
  8. sale_payments_init = fields.Float('Amount Payments', digits_compute=dp.get_precision('Account'), default=0.0) ## Payment Initial
  9. sale_residual = fields.Float('Amount Residual', digits_compute=dp.get_precision('Account'), default=0.0)##
  10. interest_qty = fields.Float('Interés %', digits=(3,6), digits_compute=dp.get_precision('Interest'), help="Interés %")
  11. interest_amount = fields.Float('Amount Interest', digits_compute=dp.get_precision('Account'), default=0.0)
  12. amount_total = fields.Float('Amount Residual + Interest ', digits_compute=dp.get_precision('Account'), default=0.0)
  13. '''Quota'''
  14. date_init = fields.Date() ## Date Initial Quota
  15. term_type_id = fields.Many2one('account.payment.term.type', string='Invoice', ondelete='restrict', index=True) ## Type term Payments
  16. quota_amount = fields.Float('Amount Quota', digits_compute=dp.get_precision('Account'), default=0.0) ## Amount Quota
  17. quota_qty = fields.Integer(string='Qty Quota', default=0) ## QTY Quota
  18. state = fields.Selection([('draft','Borrador'),('posted', 'Fijado')], default='draft')
  19. lines = fields.One2many('account.sale.term.line', 'sale_term_id', string='sale term line')
  20. sale_id = fields.Many2one('sale.order', string='Sale Orden', ondelete='restrict', index=True)
  21. class AccountSaleTermLine(models.Model):
  22. _name = 'account.sale.term.line'
  23. sale_term_id = fields.Many2one('account.sale.term', string='Sale term', ondelete='cascade', index=True)
  24. sale_id = fields.Many2one('sale.order', string='Sale Orden', ondelete='restrict', index=True)
  25. number = fields.Integer(string='number', default=0)
  26. cuota_number = fields.Char('number Cuota')
  27. date = fields.Date()
  28. amount = fields.Float('Amount Quota', digits_compute=dp.get_precision('Account'), default=0.0)
  29. days = fields.Integer(string='days', default=0)
  30. value = fields.Char('Type')
  31. class saleOrderTermConfig(models.Model):
  32. _inherit = 'sale.order'
  33. sale_term = fields.One2many('account.sale.term', 'sale_id', string=' Account Interest')
  34. sale_term_line = fields.One2many('account.sale.term.line', 'sale_id', string=' Account Interest')
  35. class saleOrderLineTermConfig(models.Model):
  36. _inherit = 'sale.order.line'
  37. is_discount_sale_term = fields.Boolean('',default=False)
  38. amount_line_interest = fields.Float('Amount Interest', digits_compute=dp.get_precision('Account'), default=0.0)