fix: pricing rule working on non pricing rule items

This commit is contained in:
Rohit Waghchaure
2019-12-11 21:55:28 +05:30
parent 47e786ef62
commit d458e25dc5
3 changed files with 4 additions and 2 deletions

View File

@@ -247,6 +247,7 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None):
rules.append(get_pricing_rule_details(args, pricing_rule))
if pricing_rule.mixed_conditions or pricing_rule.apply_rule_on_other:
item_details.apply_rule_on_other_items = 1
continue
if pricing_rule.coupon_code_based==1 and args.coupon_code==None:

View File

@@ -410,7 +410,8 @@ def validate_pricing_rule_on_items(doc, item_row, do_not_validate = False):
for pricing_rule in get_applied_pricing_rules(doc, item_row):
pr_doc = frappe.get_doc('Pricing Rule', pricing_rule)
if pr_doc.get('apply_on') == 'Transaction': continue
if (pr_doc.get('apply_on') == 'Transaction'
or not pr_doc.get("mixed_conditions")): continue
if pr_doc.get('price_or_product_discount') == 'Product':
apply_pricing_rule_for_free_items(doc, pr_doc)

View File

@@ -1352,7 +1352,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
let me = this;
const fields = ["discount_percentage", "discount_amount", "pricing_rules"];
if (item.pricing_rules) {
if (item.pricing_rules && item.apply_rule_on_other_items) {
frappe.call({
method: "erpnext.accounts.doctype.pricing_rule.utils.validate_pricing_rule_for_different_cond",
args: {