fix: apply margin on duplicated doc too

This commit is contained in:
Ankush Menat 2022-03-01 11:48:28 +05:30
parent 3a547cb0d9
commit bbc4710fa3

View File

@ -116,11 +116,11 @@ class calculate_taxes_and_totals(object):
if item.discount_percentage == 100:
item.rate = 0.0
elif item.price_list_rate:
if item.pricing_rules or item.discount_percentage > 0:
if item.pricing_rules or abs(item.discount_percentage) > 0:
item.rate = flt(item.price_list_rate *
(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
item.discount_amount = item.price_list_rate * (item.discount_percentage / 100.0)
elif item.discount_amount and item.pricing_rules:
elif item.discount_amount or item.pricing_rules:
item.rate = item.price_list_rate - item.discount_amount
if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item', 'POS Invoice Item', 'Purchase Invoice Item', 'Purchase Order Item', 'Purchase Receipt Item']: