diff --git a/production.py b/production.py index 5b231df6d1..354e5ddf57 100644 --- a/production.py +++ b/production.py @@ -11,6 +11,8 @@ from trytond.model.exceptions import AccessError from trytond.pyson import Eval, Bool from trytond.transaction import Transaction +from trytond.modules.product import round_price + class Production(metaclass=PoolMeta): __name__ = 'production' @@ -60,8 +62,7 @@ class Production(metaclass=PoolMeta): cycle_cost = Decimal(cycle_cost) cost += cycle_cost - digits = self.__class__.cost.digits - return cost.quantize(Decimal(str(10 ** -digits[1]))) + return round_price(cost) @classmethod @ModelView.button diff --git a/tryton.cfg b/tryton.cfg index d34a0f811c..1bcbcb1c81 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -3,6 +3,7 @@ version=5.5.0 depends: company ir + product production production_routing stock diff --git a/work.py b/work.py index 9e7c20266c..d09912fe5a 100644 --- a/work.py +++ b/work.py @@ -14,7 +14,7 @@ from trytond.pool import Pool from trytond.pyson import Eval, If, Bool from trytond.transaction import Transaction -from trytond.modules.product import price_digits +from trytond.modules.product import price_digits, round_price from .exceptions import PickerError @@ -314,7 +314,6 @@ class WorkCycle(Workflow, ModelSQL, ModelView): if center.cost_method == 'cycle': self.cost = center.cost_price elif center.cost_method == 'hour': - digits = self.__class__.cost.digits hours = self.duration.total_seconds() / (60 * 60) self.cost = center.cost_price * Decimal(str(hours)) - self.cost = self.cost.quantize(Decimal(str(10 ** -digits[1]))) + self.cost = round_price(self.cost)