fix: Revert rate calculation
(cherry picked from commit 6937a498e71cffc56cad65141f561b4c8785d185)
This commit is contained in:
parent
54cdff7947
commit
a83a0a03b1
@ -114,18 +114,14 @@ class calculate_taxes_and_totals(object):
|
|||||||
for item in self.doc.get("items"):
|
for item in self.doc.get("items"):
|
||||||
self.doc.round_floats_in(item)
|
self.doc.round_floats_in(item)
|
||||||
|
|
||||||
if not item.rate:
|
|
||||||
item.rate = item.price_list_rate
|
|
||||||
|
|
||||||
if item.discount_percentage == 100:
|
if item.discount_percentage == 100:
|
||||||
item.rate = 0.0
|
item.rate = 0.0
|
||||||
elif item.price_list_rate:
|
elif item.price_list_rate:
|
||||||
if item.pricing_rules or abs(item.discount_percentage) > 0:
|
if not item.rate or (item.pricing_rules and item.discount_percentage > 0):
|
||||||
item.rate = flt(item.price_list_rate *
|
item.rate = flt(item.price_list_rate *
|
||||||
(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
|
(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
|
||||||
|
|
||||||
if abs(item.discount_percentage) > 0:
|
item.discount_amount = item.price_list_rate * (item.discount_percentage / 100.0)
|
||||||
item.discount_amount = item.price_list_rate * (item.discount_percentage / 100.0)
|
|
||||||
|
|
||||||
elif item.discount_amount or item.pricing_rules:
|
elif item.discount_amount or item.pricing_rules:
|
||||||
item.rate = item.price_list_rate - item.discount_amount
|
item.rate = item.price_list_rate - item.discount_amount
|
||||||
|
Loading…
Reference in New Issue
Block a user