Merge branch 'main' into 6.8
This commit is contained in:
commit
784a447d35
1 changed files with 4 additions and 6 deletions
10
mixin.py
10
mixin.py
|
@ -4,13 +4,13 @@
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
|
||||||
from decimal import Decimal, ROUND_HALF_EVEN
|
from decimal import Decimal
|
||||||
import html
|
import html
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.tools import cached_property
|
from trytond.tools import cached_property
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.modules.product import price_digits
|
from trytond.modules.product import round_price
|
||||||
|
|
||||||
|
|
||||||
class EdocumentMixin(object):
|
class EdocumentMixin(object):
|
||||||
|
@ -193,10 +193,8 @@ class EdocumentMixin(object):
|
||||||
Returns:
|
Returns:
|
||||||
Decimal: rounded value
|
Decimal: rounded value
|
||||||
"""
|
"""
|
||||||
if isinstance(value, Decimal):
|
if value is not None:
|
||||||
return value.quantize(
|
return round_price(value)
|
||||||
Decimal(str(1/10 ** price_digits[1])),
|
|
||||||
ROUND_HALF_EVEN)
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def quote_text(self, text):
|
def quote_text(self, text):
|
||||||
|
|
Loading…
Reference in a new issue