Merge pull request #30008 from frappe/mergify/bp/version-14-beta-pre-release/pr-29991
fix(pos): minor fixes (backport #29991)
This commit is contained in:
commit
6ca508fd85
@ -439,7 +439,6 @@ class POSInvoice(SalesInvoice):
|
|||||||
self.paid_amount = 0
|
self.paid_amount = 0
|
||||||
|
|
||||||
def set_account_for_mode_of_payment(self):
|
def set_account_for_mode_of_payment(self):
|
||||||
self.payments = [d for d in self.payments if d.amount or d.base_amount or d.default]
|
|
||||||
for pay in self.payments:
|
for pay in self.payments:
|
||||||
if not pay.account:
|
if not pay.account:
|
||||||
pay.account = get_bank_cash_account(pay.mode_of_payment, self.company).get("account")
|
pay.account = get_bank_cash_account(pay.mode_of_payment, self.company).get("account")
|
||||||
|
|||||||
@ -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,8 +170,7 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frappe.ui.form.on('POS Invoice', 'coupon_code', (frm) => {
|
frappe.ui.form.on('POS Invoice', 'coupon_code', (frm) => {
|
||||||
if (!frm.doc.ignore_pricing_rule) {
|
if (!frm.doc.ignore_pricing_rule && frm.doc.coupon_code) {
|
||||||
if (frm.doc.coupon_code) {
|
|
||||||
frappe.run_serially([
|
frappe.run_serially([
|
||||||
() => frm.doc.ignore_pricing_rule=1,
|
() => frm.doc.ignore_pricing_rule=1,
|
||||||
() => frm.trigger('ignore_pricing_rule'),
|
() => frm.trigger('ignore_pricing_rule'),
|
||||||
@ -180,15 +179,11 @@ erpnext.PointOfSale.Payment = class {
|
|||||||
() => frm.save(),
|
() => frm.save(),
|
||||||
() => this.update_totals_section(frm.doc)
|
() => this.update_totals_section(frm.doc)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else if (frm.doc.ignore_pricing_rule && frm.doc.coupon_code) {
|
||||||
frappe.run_serially([
|
frappe.show_alert({
|
||||||
() => frm.doc.ignore_pricing_rule=1,
|
message: __("Ignore Pricing Rule is enabled. Cannot apply coupon code."),
|
||||||
() => frm.trigger('ignore_pricing_rule'),
|
indicator: "orange"
|
||||||
() => frm.doc.ignore_pricing_rule=0,
|
});
|
||||||
() => frm.save(),
|
|
||||||
() => this.update_totals_section(frm.doc)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user