Merge pull request #29860 from frappe/mergify/bp/version-13-hotfix/pr-29859
fix: coupon code is applied even if ignore_pricing_rule is enabled (backport #29859)
This commit is contained in:
@@ -2265,20 +2265,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
coupon_code: function() {
|
coupon_code: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (this.frm.doc.coupon_code) {
|
frappe.run_serially([
|
||||||
frappe.run_serially([
|
() => this.frm.doc.ignore_pricing_rule=1,
|
||||||
() => this.frm.doc.ignore_pricing_rule=1,
|
() => me.ignore_pricing_rule(),
|
||||||
() => me.ignore_pricing_rule(),
|
() => this.frm.doc.ignore_pricing_rule=0,
|
||||||
() => this.frm.doc.ignore_pricing_rule=0,
|
() => me.apply_pricing_rule()
|
||||||
() => me.apply_pricing_rule(),
|
]);
|
||||||
() => this.frm.save()
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
frappe.run_serially([
|
|
||||||
() => this.frm.doc.ignore_pricing_rule=1,
|
|
||||||
() => me.ignore_pricing_rule()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,29 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on('POS Invoice', 'coupon_code', (frm) => {
|
||||||
|
if (!frm.doc.ignore_pricing_rule) {
|
||||||
|
if (frm.doc.coupon_code) {
|
||||||
|
frappe.run_serially([
|
||||||
|
() => frm.doc.ignore_pricing_rule=1,
|
||||||
|
() => frm.trigger('ignore_pricing_rule'),
|
||||||
|
() => frm.doc.ignore_pricing_rule=0,
|
||||||
|
() => frm.trigger('apply_pricing_rule'),
|
||||||
|
() => frm.save(),
|
||||||
|
() => this.update_totals_section(frm.doc)
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
frappe.run_serially([
|
||||||
|
() => frm.doc.ignore_pricing_rule=1,
|
||||||
|
() => frm.trigger('ignore_pricing_rule'),
|
||||||
|
() => frm.doc.ignore_pricing_rule=0,
|
||||||
|
() => frm.save(),
|
||||||
|
() => this.update_totals_section(frm.doc)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.setup_listener_for_payments();
|
this.setup_listener_for_payments();
|
||||||
|
|
||||||
this.$payment_modes.on('click', '.shortcut', function() {
|
this.$payment_modes.on('click', '.shortcut', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user