[FIX] product: pricelist surcharges and margin incorrectly converted
When using a pricelist with a currency different than the one
of the product, the prices used in the pricelist (surcharge, min_margin,
& max_margin) are using the default currency of the company which is invalid.
To reproduce the issue:
1. Enable multiple currency and enable a second one with an exagerated rate for the sake of clarity.
2. Create a formula pricelist with the newly activated currency using either surcharge or the margin.
3. Create a SO with a standard product. By switching between pricelist, you will see an invalid price.
E.G.:
EUR_rates = 2 compared to USD PRICELIST = surcharge of 10€ on any product
PRODUCT_price = 300$ PRODUCT_price_euros = 150€
CURRENT_SO_price = (300 + 10)/rate_EUR = (300 + 10)/2 = 155€
EXPECTED_SO_price = (300 + 10*rate_EUR)/rate_EUR = (300 + 10*2)/2 = 160€
Solution:
Convert the pricelist item margin & surcharges to the base price currency.
To do so, the needed currency conversion date is given through the context.
opw-2760720
closes odoo/odoo#87018
Signed-off-by:
Victor Feyens (vfe) <vfe@odoo.com>
Loading