[Fix] Pricing rule discount issue
This commit is contained in:
parent
d5e52bc251
commit
43b508089e
@ -165,6 +165,13 @@ def get_pricing_rule_for_item(args):
|
|||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
item_details.discount_percentage = pricing_rule.discount_percentage
|
item_details.discount_percentage = pricing_rule.discount_percentage
|
||||||
|
elif args.get('pricing_rule'):
|
||||||
|
if frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), 'price_or_discount') == 'Discount Percentage':
|
||||||
|
item_details.discount_percentage = 0.0
|
||||||
|
|
||||||
|
item_details.margin_rate_or_amount = 0.0
|
||||||
|
item_details.margin_type = None
|
||||||
|
|
||||||
return item_details
|
return item_details
|
||||||
|
|
||||||
def get_pricing_rules(args):
|
def get_pricing_rules(args):
|
||||||
|
@ -15,10 +15,6 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
|
|
||||||
},
|
},
|
||||||
apply_pricing_rule_on_item: function(item){
|
apply_pricing_rule_on_item: function(item){
|
||||||
if(!item.margin_type){
|
|
||||||
item.margin_rate_or_amount = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(item.margin_type == "Percentage"){
|
if(item.margin_type == "Percentage"){
|
||||||
item.total_margin = item.price_list_rate + item.price_list_rate * ( item.margin_rate_or_amount / 100);
|
item.total_margin = item.price_list_rate + item.price_list_rate * ( item.margin_rate_or_amount / 100);
|
||||||
}else{
|
}else{
|
||||||
|
@ -720,7 +720,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
"brand": d.brand,
|
"brand": d.brand,
|
||||||
"qty": d.qty,
|
"qty": d.qty,
|
||||||
"parenttype": d.parenttype,
|
"parenttype": d.parenttype,
|
||||||
"parent": d.parent
|
"parent": d.parent,
|
||||||
|
"pricing_rule": d.pricing_rule
|
||||||
});
|
});
|
||||||
|
|
||||||
// if doctype is Quotation Item / Sales Order Iten then add Margin Type and rate in item_list
|
// if doctype is Quotation Item / Sales Order Iten then add Margin Type and rate in item_list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user