|
|
@@ -1,28 +1,27 @@
|
|
|
-# -*- coding: utf-8 -*-
|
|
|
-
|
|
|
from openerp import models, fields, api
|
|
|
|
|
|
|
|
|
class AccountVoucher(models.Model):
|
|
|
_inherit = 'account.voucher'
|
|
|
|
|
|
- comision = fields.Float(
|
|
|
+ comision = fields.Integer(
|
|
|
string='Comisión',
|
|
|
compute='_compute_comision',
|
|
|
store=True
|
|
|
)
|
|
|
|
|
|
- @api.model
|
|
|
- def _get_porcentaje(self):
|
|
|
+ @api.depends('amount')
|
|
|
+ def _compute_comision(self):
|
|
|
+
|
|
|
param = self.env['ir.config_parameter'].get_param(
|
|
|
'voucher_comision.porcentaje', '2'
|
|
|
)
|
|
|
- return float(param)
|
|
|
|
|
|
- @api.depends('amount')
|
|
|
- def _compute_comision(self):
|
|
|
- porcentaje = self._get_porcentaje()
|
|
|
+ porcentaje = float(param)
|
|
|
|
|
|
for rec in self:
|
|
|
- rec.comision = rec.amount * porcentaje / 100 if rec.amount else 0
|
|
|
-
|
|
|
+ if rec.amount:
|
|
|
+ valor = rec.amount * porcentaje / 100
|
|
|
+ rec.comision = int(round(valor))
|
|
|
+ else:
|
|
|
+ rec.comision = 0
|