Commit 53b3bcb5 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_pdm: round price when price per sclice is used

As the calculation method computes a total_price, it is import
to have enough significative numbers in the result so on the
movement quantity * price really equals the total price
parent 373ddc6b
from math import log
result = context.getPriceParameterDict(context=movement, **kw)
# XXX: Add "stepped_price" in calculation
# sliced_base_price = {'price': 10.0, 'sliced_range': (1, None)}
......@@ -30,7 +32,7 @@ if result["sliced_base_price"]:
slice_min = 1
priced_quantity = min(slice_max - 1, quantity) - (slice_min - 1)
total_price += priced_quantity * slice_price
result["base_price"] = total_price / quantity
result["base_price"] = round(total_price / quantity, int(round(- log(result['base_unit_price'], 10),0)))
base_price = result["base_price"]
if base_price in (None, ""):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment