add price_digits() to mixin.py

This commit is contained in:
Frederik Jaeckel 2025-01-29 10:01:05 +01:00
parent f944b9019c
commit 2cfdf25d7b

View file

@ -10,7 +10,15 @@ from trytond.exceptions import UserError
from trytond.modules.tryton6_backport.i18n import gettext
from cached_property import cached_property
from trytond.pool import Pool
from trytond.modules.product import round_price
from trytond.modules.product import price_digits
def round_price(value, rounding=None):
"Round price using the price digits"
if isinstance(value, int):
return Decimal(value)
return value.quantize(
Decimal(1) / 10 ** price_digits[1], rounding=rounding)
class EdocumentMixin(object):