[Fix] Ignore pricing rule not removed the discount percentage
This commit is contained in:
parent
da3a9e255d
commit
2976e56d23
@ -126,6 +126,8 @@ def get_pricing_rule_for_item(args):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if args.ignore_pricing_rule or not args.item_code:
|
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
|
return item_details
|
||||||
|
|
||||||
if not (args.item_group and args.brand):
|
if not (args.item_group and args.brand):
|
||||||
@ -166,9 +168,16 @@ 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'):
|
elif args.get('pricing_rule'):
|
||||||
if frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), 'price_or_discount') == 'Discount Percentage':
|
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
|
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_rate_or_amount = 0.0
|
||||||
item_details.margin_type = None
|
item_details.margin_type = None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user