Skip to content
Snippets Groups Projects
Commit 74111d1f authored by mightyjol (jhk)'s avatar mightyjol (jhk)
Browse files

[FIX]product:change pricelist fixed_price field from float to monetary


steps to reproduce:
-change decimal accuracy for "Product Price"
-create a price list with fixed price
-the fixed price field does not takes the decimal accuracy into account

this was working in V11 and V12
fixed_price was a float field like other price fields

previous behavior:
fixed_price is a monetary field
when setting up a fixed price for a pricelist, it takes into account
the precision from the current currency

current behavior:
fixed_price is a float field
when setting up a fixed price for a pricelist, it takes into account
the proper decimal accuracy setting ("Product Price")

opw-2121964

closes odoo/odoo#40807

X-original-commit: 27b90fc7
Signed-off-by: default avatarJorge Pinna Puissant (jpp) <jpp@odoo.com>
parent 72910211
No related branches found
No related tags found
No related merge requests found
......@@ -449,7 +449,7 @@ class PricelistItem(models.Model):
('fixed', 'Fixed Price'),
('percentage', 'Percentage (discount)'),
('formula', 'Formula')], index=True, default='fixed', required=True)
fixed_price = fields.Monetary('Fixed Price')
fixed_price = fields.Float('Fixed Price', digits='Product Price')
percent_price = fields.Float('Percentage Price')
# functional fields used for usability purposes
name = fields.Char(
......@@ -495,11 +495,12 @@ 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,
item.currency_id.decimal_places,
decimal_places,
),
item.currency_id.symbol,
)
......@@ -508,7 +509,7 @@ class PricelistItem(models.Model):
item.currency_id.symbol,
float_repr(
item.fixed_price,
item.currency_id.decimal_places,
decimal_places,
),
)
elif item.compute_price == 'percentage':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment