12345678910111213141516171819202122232425262728293031323334 |
- # -*- coding: utf-8 -*-
- from openerp import models, fields, tools, api
- import openerp.addons.decimal_precision as dp
- class AccontPaymentsTermConfig(models.Model):
- _name = 'accont.payments.term.config'
- name = fields.Char('Name', required=True, readonly=True)
- interest_rate = fields.Float('Tasa de interés', digits=(3,6), digits_compute=dp.get_precision('Interest'), required=True, help="Tasa de interés %")
- message_default = fields.Char('Message', default='La tasa de interés por defecto es 4% mensual, tasa diaria (4 / 30 = 0,1333).')
- compute = fields.Boolean(help="Indica si sera calculado los interés")
- comment = fields.Text('Comment', help="Información adicional")
- @api.model
- def _create_default_config(self):
- config = {
- 'name': 'Interés por cambio de fecha de cuota',
- 'interest_rate': '0.1333',
- 'compute': True,
- }
- termConfig = self.env['accont.payments.term.config'].search([('name','=', config['name'])])
- if (not termConfig):
- self.env['accont.payments.term.config'].create({
- 'name': config['name'],
- 'interest_rate': config['interest_rate'],
- 'compute': config['compute'],
- })
- class SaleOrderLineInterest(models.Model):
- _inherit = 'sale.order.line'
- is_interest = fields.Boolean('Is Interest',default=False)
|