mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-24 21:52:21 +01:00
fix: check if pricing rule matches with coupon code (#44104)
* fix: check if pricing rule matches with coupon code
* fix: correct linting error
(cherry picked from commit 9d31bf7647)
This commit is contained in:
@@ -451,6 +451,16 @@ def get_pricing_rule_for_item(args, doc=None, for_validate=False):
|
|||||||
get_pricing_rule_items(pricing_rule, other_items=fetch_other_item) or []
|
get_pricing_rule_items(pricing_rule, other_items=fetch_other_item) or []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if pricing_rule.coupon_code_based == 1:
|
||||||
|
if not args.coupon_code:
|
||||||
|
return item_details
|
||||||
|
|
||||||
|
coupon_code = frappe.db.get_value(
|
||||||
|
doctype="Coupon Code", filters={"pricing_rule": pricing_rule.name}, fieldname="name"
|
||||||
|
)
|
||||||
|
if args.coupon_code != coupon_code:
|
||||||
|
continue
|
||||||
|
|
||||||
if pricing_rule.get("suggestion"):
|
if pricing_rule.get("suggestion"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -476,9 +486,6 @@ def get_pricing_rule_for_item(args, doc=None, for_validate=False):
|
|||||||
pricing_rule.apply_rule_on_other_items
|
pricing_rule.apply_rule_on_other_items
|
||||||
)
|
)
|
||||||
|
|
||||||
if pricing_rule.coupon_code_based == 1 and args.coupon_code is None:
|
|
||||||
return item_details
|
|
||||||
|
|
||||||
if not pricing_rule.validate_applied_rule:
|
if not pricing_rule.validate_applied_rule:
|
||||||
if pricing_rule.price_or_product_discount == "Price":
|
if pricing_rule.price_or_product_discount == "Price":
|
||||||
apply_price_discount_rule(pricing_rule, item_details, args)
|
apply_price_discount_rule(pricing_rule, item_details, args)
|
||||||
|
|||||||
Reference in New Issue
Block a user