Merge pull request #7194 from rohitwaghchaure/pricing_rule_issue_v7_1
[Fix] Ignore pricing rule not removed the discount percentage
This commit is contained in:
commit
c5869a00df
@ -126,6 +126,8 @@ def get_pricing_rule_for_item(args):
|
||||
})
|
||||
|
||||
if args.ignore_pricing_rule or not args.item_code:
|
||||
if args.name and args.get("pricing_rule"):
|
||||
item_details = remove_pricing_rule(args, item_details)
|
||||
return item_details
|
||||
|
||||
if not (args.item_group and args.brand):
|
||||
@ -166,9 +168,16 @@ def get_pricing_rule_for_item(args):
|
||||
else:
|
||||
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 = remove_pricing_rule(args, item_details)
|
||||
|
||||
return item_details
|
||||
|
||||
def remove_pricing_rule(args, item_details):
|
||||
pricing_rule = frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), ['price_or_discount', 'margin_type'], as_dict=1)
|
||||
if pricing_rule and pricing_rule.price_or_discount == 'Discount Percentage':
|
||||
item_details.discount_percentage = 0.0
|
||||
|
||||
if pricing_rule and pricing_rule.margin_type in ['Percentage', 'Amount']:
|
||||
item_details.margin_rate_or_amount = 0.0
|
||||
item_details.margin_type = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user