diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 6219f68ffe5..c5571970595 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -395,7 +395,8 @@ def remove_pricing_rule_for_item(pricing_rules, item_details, item_code=None): items = get_pricing_rule_items(pricing_rule) item_details.apply_on = (frappe.scrub(pricing_rule.apply_rule_on_other) if pricing_rule.apply_rule_on_other else frappe.scrub(pricing_rule.get('apply_on'))) - item_details.applied_on_items = ','.join(items) + item_details.applied_on_items = json.dumps(items) + item_details.price_or_product_discount = pricing_rule.price_or_product_discount item_details.pricing_rules = '' diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 2c4277674cf..3c71a45309c 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1412,9 +1412,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ if (data && data.apply_rule_on_other_items) { me.frm.doc.items.forEach(d => { - if (in_list(data.apply_rule_on_other_items, d[data.apply_rule_on])) { + if (in_list(JSON.parse(data.apply_rule_on_other_items), d[data.apply_rule_on])) { for(var k in data) { - if (in_list(fields, k) && data[k] && (data.price_or_product_discount === 'price' || k === 'pricing_rules')) { + if (in_list(fields, k) && data[k] && (data.price_or_product_discount === 'Price' || k === 'pricing_rules')) { frappe.model.set_value(d.doctype, d.name, k, data[k]); } } @@ -1498,9 +1498,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ me.frm.doc.items = items; refresh_field('items'); } else if(item.applied_on_items && item.apply_on) { - const applied_on_items = item.applied_on_items.split(','); + const applied_on_items = JSON.parse(item.applied_on_items); me.frm.doc.items.forEach(row => { - if(applied_on_items.includes(row[item.apply_on])) { + if(in_list(applied_on_items, row[item.apply_on])) { fields.forEach(f => { row[f] = 0; });