mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
Merge pull request #47777 from frappe/mergify/bp/version-15-hotfix/pr-47041
fix: Check `return_against` and Await API Call (backport #47041)
This commit is contained in:
@@ -64,7 +64,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
&& this.frm.doc.is_pos
|
&& this.frm.doc.is_pos
|
||||||
&& this.frm.doc.is_return
|
&& this.frm.doc.is_return
|
||||||
) {
|
) {
|
||||||
this.set_total_amount_to_default_mop();
|
await this.set_total_amount_to_default_mop();
|
||||||
this.calculate_paid_amount();
|
this.calculate_paid_amount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,23 +896,25 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
it should set the return to that mode of payment only.
|
it should set the return to that mode of payment only.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let return_against_mop = await frappe.call({
|
if(this.frm.doc.return_against){
|
||||||
method: 'erpnext.controllers.sales_and_purchase_return.get_payment_data',
|
let {message : return_against_mop } = await frappe.call({
|
||||||
args: {
|
method: 'erpnext.controllers.sales_and_purchase_return.get_payment_data',
|
||||||
invoice: this.frm.doc.return_against
|
args: {
|
||||||
}
|
invoice: this.frm.doc.return_against
|
||||||
});
|
|
||||||
|
|
||||||
if (return_against_mop.message.length === 1) {
|
|
||||||
this.frm.doc.payments.forEach(payment => {
|
|
||||||
if (payment.mode_of_payment == return_against_mop.message[0].mode_of_payment) {
|
|
||||||
payment.amount = total_amount_to_pay;
|
|
||||||
} else {
|
|
||||||
payment.amount = 0;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.frm.refresh_fields();
|
|
||||||
return;
|
if (return_against_mop.length === 1) {
|
||||||
|
this.frm.doc.payments.forEach(payment => {
|
||||||
|
if (payment.mode_of_payment == return_against_mop[0].mode_of_payment) {
|
||||||
|
payment.amount = total_amount_to_pay;
|
||||||
|
} else {
|
||||||
|
payment.amount = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.frm.refresh_fields();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.frm.doc.payments.find(payment => {
|
this.frm.doc.payments.find(payment => {
|
||||||
|
|||||||
@@ -870,8 +870,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
|
frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
validate() {
|
async validate() {
|
||||||
this.calculate_taxes_and_totals(false);
|
await this.calculate_taxes_and_totals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_stock() {
|
update_stock() {
|
||||||
|
|||||||
Reference in New Issue
Block a user