ソースを参照

This module allows to add comision en voucher.

SEBAS 3 ヶ月 前
コミット
34f544ce66
1 ファイル変更6 行追加1 行削除
  1. 6 1
      models/account_voucher.py

+ 6 - 1
models/account_voucher.py

@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 from openerp import models, fields, api
+import math
 
 
 class AccountVoucher(models.Model):
@@ -22,7 +23,11 @@ class AccountVoucher(models.Model):
 
         for rec in self:
             if rec.state == 'posted' and rec.amount:
+
                 valor = rec.amount * porcentaje / 100
-                rec.comision = int(round(valor))
+
+                # ✔ redondeo sin decimal estable
+                rec.comision = int(valor + 0.5)
+
             else:
                 rec.comision = 0