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