fix(pos): coupon code is applied even if ignore pricing rule is check
This commit is contained in:
parent
69c34cd7ae
commit
81514516f3
@ -2285,14 +2285,18 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
}
|
||||
|
||||
coupon_code() {
|
||||
var me = this;
|
||||
frappe.run_serially([
|
||||
if (this.frm.doc.coupon_code || this.frm._last_coupon_code) {
|
||||
// reset pricing rules if coupon code is set or is unset
|
||||
const _ignore_pricing_rule = this.frm.doc.ignore_pricing_rule;
|
||||
return frappe.run_serially([
|
||||
() => this.frm.doc.ignore_pricing_rule=1,
|
||||
() => me.ignore_pricing_rule(),
|
||||
() => this.frm.doc.ignore_pricing_rule=0,
|
||||
() => me.apply_pricing_rule()
|
||||
() => this.frm.trigger('ignore_pricing_rule'),
|
||||
() => this.frm.doc.ignore_pricing_rule=_ignore_pricing_rule,
|
||||
() => this.frm.trigger('apply_pricing_rule'),
|
||||
() => this.frm._last_coupon_code = this.frm.doc.coupon_code
|
||||
]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
erpnext.show_serial_batch_selector = function (frm, d, callback, on_close, show_dialog) {
|
||||
|
@ -170,8 +170,7 @@ erpnext.PointOfSale.Payment = class {
|
||||
});
|
||||
|
||||
frappe.ui.form.on('POS Invoice', 'coupon_code', (frm) => {
|
||||
if (!frm.doc.ignore_pricing_rule) {
|
||||
if (frm.doc.coupon_code) {
|
||||
if (!frm.doc.ignore_pricing_rule && frm.doc.coupon_code) {
|
||||
frappe.run_serially([
|
||||
() => frm.doc.ignore_pricing_rule=1,
|
||||
() => frm.trigger('ignore_pricing_rule'),
|
||||
@ -180,7 +179,11 @@ erpnext.PointOfSale.Payment = class {
|
||||
() => frm.save(),
|
||||
() => this.update_totals_section(frm.doc)
|
||||
]);
|
||||
}
|
||||
} else if (frm.doc.ignore_pricing_rule && frm.doc.coupon_code) {
|
||||
frappe.show_alert({
|
||||
message: __("Ignore Pricing Rule is enabled. Cannot apply coupon code."),
|
||||
indicator: "orange"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user