Skip to content
Snippets Groups Projects
Commit ab6fe46e authored by Nshimiyimana Séna's avatar Nshimiyimana Séna Committed by Victor Feyens
Browse files

[FIX] product: apply pricelist formula rounding AFTER currency conversion


The setup:
* activate multicurrency and a secondary currency, for example the DKK.
  Make sure the exchange rate is not 1.
* in Settings - Sales - Pricelists, activate Advanced Price Rules
* create a new DKK pricelist with the following settings:
  * Compute Formula
  * Based on Sales Price
  * Discount 42% (or any another value)
  * Rounding Method 1.00
  * Apply on All Products
  * Min Quantity 10

Steps to reproduce:
* create a new sales order
* set Pricelist = the DKK pricelist you created
* add a product and set the quantity to 10

You should see that the total, after application of the pricelist, is
not rounded.

Cause:
The price is being rounded before conversion to the pricelist's
currency.

Solution:

Finetuning of b7ec0a2e
to make sure the pricelist base price is consistently rounded
before applying the rule formula (surcharge, margins, rounding, ...).

Previously, the price given to _compute_price was:

* in the pricelist currency if the rule is based on another pricelist
* in the product currency if the rule is based on the sales price
* in the product cost currency if the rule is based on the cost

Now, the price given is always in the pricelist currency.
This modifies the API of the method in stable (modifying the currency
of the price input), but is quite a logical change and required to fix
the issue at hand.

Note:
The issue is fixed as of v15.2

opw-3002376

closes odoo/odoo#102920

Signed-off-by: default avatarVictor Feyens (vfe) <vfe@odoo.com>
parent d0659142
No related branches found
No related tags found
No related merge requests found
Loading
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