Browse Source

fix: Pricing Rule on Transaction Based on Coupon (#26949)

develop
Lovin Maxwell 3 years ago
committed by GitHub
parent
commit
f91faac7cd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      erpnext/accounts/doctype/pricing_rule/utils.py

15
erpnext/accounts/doctype/pricing_rule/utils.py

@ -475,7 +475,20 @@ def apply_pricing_rule_on_transaction(doc):
frappe.msgprint(_("User has not applied rule on the invoice {0}")
.format(doc.name))
else:
doc.set(field, d.get(pr_field))
if not d.coupon_code_based:
doc.set(field, d.get(pr_field))
elif doc.get('coupon_code'):
# coupon code based pricing rule
coupon_code_pricing_rule = frappe.db.get_value('Coupon Code', doc.get('coupon_code'), 'pricing_rule')
if coupon_code_pricing_rule == d.name:
# if selected coupon code is linked with pricing rule
doc.set(field, d.get(pr_field))
else:
# reset discount if not linked
doc.set(field, 0)
else:
# if coupon code based but no coupon code selected
doc.set(field, 0)
doc.calculate_taxes_and_totals()
elif d.price_or_product_discount == 'Product':

Loading…
Cancel
Save