changeset 01f27d49d3c7 in modules/purchase_request:default
details:
https://hg.tryton.org/modules/purchase_request?cmd=changeset;node=01f27d49d3c7
description:
Add round_price
We add a common method to round prices that are stored using the price
digits.
It is useless to use the digits from the field because it can not be
changed in
any other way than by configuration.
issue9146
review299521002
diffstat:
purchase_request.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r 82714a4dc886 -r 01f27d49d3c7 purchase_request.py
--- a/purchase_request.py Fri Apr 10 18:53:44 2020 +0200
+++ b/purchase_request.py Thu Apr 23 21:44:00 2020 +0200
@@ -15,6 +15,7 @@
from trytond.modules.company.model import (
employee_field, set_employee, reset_employee)
+from trytond.modules.product import round_price
STATES = {
'readonly': Eval('state') != 'draft',
@@ -479,8 +480,7 @@
Line = pool.get('purchase.line')
line = Line()
- line.unit_price = Decimal(0).quantize(
- Decimal(1) / 10 ** Line.unit_price.digits[1])
+ line.unit_price = round_price(Decimal(0))
for f, v in key:
setattr(line, f, v)
line.quantity = sum(r.quantity for r in requests)