fix: Incorrect default amount to pay for POS invoices
This commit is contained in:
@@ -34,12 +34,12 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
frappe.model.set_value(item.doctype, item.name, "rate", item_rate);
|
||||
},
|
||||
|
||||
calculate_taxes_and_totals: function(update_paid_amount) {
|
||||
calculate_taxes_and_totals: async function(update_paid_amount) {
|
||||
this.discount_amount_applied = false;
|
||||
this._calculate_taxes_and_totals();
|
||||
this.calculate_discount_amount();
|
||||
|
||||
this.calculate_shipping_charges();
|
||||
await this.calculate_shipping_charges();
|
||||
|
||||
// Advance calculation applicable to Sales /Purchase Invoice
|
||||
if(in_list(["Sales Invoice", "POS Invoice", "Purchase Invoice"], this.frm.doc.doctype)
|
||||
@@ -273,8 +273,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
calculate_shipping_charges: function() {
|
||||
frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]);
|
||||
if (frappe.meta.get_docfield(this.frm.doc.doctype, "shipping_rule", this.frm.doc.name)) {
|
||||
this.shipping_rule();
|
||||
this._calculate_taxes_and_totals();
|
||||
return this.shipping_rule();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1086,6 +1086,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
return this.frm.call({
|
||||
doc: this.frm.doc,
|
||||
method: "apply_shipping_rule",
|
||||
callback: function(r) {
|
||||
me._calculate_taxes_and_totals();
|
||||
}
|
||||
}).fail(() => this.frm.set_value('shipping_rule', ''));
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user