Commit b3ed2210 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_pdm: do not round calculated average unit_price in slice case.

otherwise it loses too much precision.
parent bfdcb738
......@@ -34,10 +34,7 @@ if result["slice_base_price"]:
slice_min = 1
priced_quantity = min(slice_max - 1, quantity) - (slice_min - 1)
total_price += priced_quantity * slice_price
if result.get('base_unit_price', None) is None:
result["base_price"] = total_price / quantity
else:
result["base_price"] = round(total_price / quantity, int(round(- log(result['base_unit_price'], 10),0)))
result["base_price"] = total_price / quantity
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