fix: coupon code is applied even if ignore_pricing_rule is enabled
This commit is contained in:
parent
d9fc3f3d90
commit
2743999785
@ -2284,20 +2284,12 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
|
|
||||||
coupon_code() {
|
coupon_code() {
|
||||||
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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user