fix(pos): coupon code is applied even if ignore pricing rule is check
(cherry picked from commit 81514516f3
)
# Conflicts:
# erpnext/selling/page/point_of_sale/pos_payment.js
This commit is contained in:
parent
c75283265b
commit
823979fbcc
@ -2283,14 +2283,18 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
}
|
}
|
||||||
|
|
||||||
coupon_code() {
|
coupon_code() {
|
||||||
var me = this;
|
if (this.frm.doc.coupon_code || this.frm._last_coupon_code) {
|
||||||
frappe.run_serially([
|
// 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,
|
() => this.frm.doc.ignore_pricing_rule=1,
|
||||||
() => me.ignore_pricing_rule(),
|
() => this.frm.trigger('ignore_pricing_rule'),
|
||||||
() => this.frm.doc.ignore_pricing_rule=0,
|
() => this.frm.doc.ignore_pricing_rule=_ignore_pricing_rule,
|
||||||
() => me.apply_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) {
|
erpnext.show_serial_batch_selector = function (frm, d, callback, on_close, show_dialog) {
|
||||||
|
@ -170,6 +170,7 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('POS Invoice', 'coupon_code', (frm) => {
|
frappe.ui.form.on('POS Invoice', 'coupon_code', (frm) => {
|
||||||
|
<<<<<<< HEAD
|
||||||
if (!frm.doc.ignore_pricing_rule) {
|
if (!frm.doc.ignore_pricing_rule) {
|
||||||
if (frm.doc.coupon_code) {
|
if (frm.doc.coupon_code) {
|
||||||
frappe.run_serially([
|
frappe.run_serially([
|
||||||
@ -189,6 +190,22 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
() => this.update_totals_section(frm.doc)
|
() => this.update_totals_section(frm.doc)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
if (!frm.doc.ignore_pricing_rule && 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 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"
|
||||||
|
});
|
||||||
|
>>>>>>> 81514516f3 (fix(pos): coupon code is applied even if ignore pricing rule is check)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user