fix: mixed condition pricing rule not working on js side
This commit is contained in:
@@ -395,7 +395,8 @@ def remove_pricing_rule_for_item(pricing_rules, item_details, item_code=None):
|
|||||||
items = get_pricing_rule_items(pricing_rule)
|
items = get_pricing_rule_items(pricing_rule)
|
||||||
item_details.apply_on = (frappe.scrub(pricing_rule.apply_rule_on_other)
|
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')))
|
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 = ''
|
item_details.pricing_rules = ''
|
||||||
|
|
||||||
|
|||||||
@@ -1412,9 +1412,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
if (data && data.apply_rule_on_other_items) {
|
if (data && data.apply_rule_on_other_items) {
|
||||||
me.frm.doc.items.forEach(d => {
|
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) {
|
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]);
|
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;
|
me.frm.doc.items = items;
|
||||||
refresh_field('items');
|
refresh_field('items');
|
||||||
} else if(item.applied_on_items && item.apply_on) {
|
} 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 => {
|
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 => {
|
fields.forEach(f => {
|
||||||
row[f] = 0;
|
row[f] = 0;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user