[IMP] product: use existing tools to format amount

This commit is contained in:
Victor Feyens
2021-12-23 15:30:22 +01:00
parent a28ba8dbf3
commit 1332074c64
+3 -18
View File
@@ -5,7 +5,7 @@ from itertools import chain
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError, ValidationError
from odoo.tools import float_repr, format_datetime
from odoo.tools import format_datetime, formatLang
from odoo.tools.misc import get_lang
@@ -487,23 +487,8 @@ class PricelistItem(models.Model):
item.name = _("All Products")
if item.compute_price == 'fixed':
decimal_places = self.env['decimal.precision'].precision_get('Product Price')
if item.currency_id.position == 'after':
item.price = "%s %s" % (
float_repr(
item.fixed_price,
decimal_places,
),
item.currency_id.symbol,
)
else:
item.price = "%s %s" % (
item.currency_id.symbol,
float_repr(
item.fixed_price,
decimal_places,
),
)
item.price = formatLang(
item.env, item.fixed_price, monetary=True, dp="Product Price", currency_obj=item.currency_id)
elif item.compute_price == 'percentage':
item.price = _("%s %% discount", item.percent_price)
else: