changeset 7c52341cc482 in modules/project_revenue:default
details:
https://hg.tryton.org/modules/project_revenue?cmd=changeset;node=7c52341cc482
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:
work.py | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diffs (23 lines):
diff -r a7e81f1cf006 -r 7c52341cc482 work.py
--- a/work.py Sat Mar 28 13:06:21 2020 +0100
+++ b/work.py Thu Apr 23 21:44:00 2020 +0200
@@ -12,7 +12,7 @@
from trytond.pool import Pool, PoolMeta
from trytond.tools import reduce_ids, grouped_slice
-from trytond.modules.product import price_digits
+from trytond.modules.product import price_digits, round_price
class Work(metaclass=PoolMeta):
@@ -204,9 +204,7 @@
self.list_price = Currency.compute(user.company.currency,
self.list_price, self.company.currency, round=False)
- digits = self.__class__.list_price.digits
- self.list_price = self.list_price.quantize(
- Decimal(str(10.0 ** -digits[1])))
+ self.list_price = round_price(self.list_price)
@property
def price_list_hour(self):