mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
perf(transaction): exit early before backend query (#55556)
This commit is contained in:
@@ -459,19 +459,22 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
reference_name: frm.doc.name,
|
reference_name: frm.doc.name,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!schedules?.length) {
|
||||||
|
this.make_payment_request();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const value = await frappe.db.get_single_value(
|
const value = await frappe.db.get_single_value(
|
||||||
"Accounts Settings",
|
"Accounts Settings",
|
||||||
"fetch_payment_schedule_in_payment_request"
|
"fetch_payment_schedule_in_payment_request"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!value || !schedules.length) {
|
if (!value) {
|
||||||
this.make_payment_request();
|
this.make_payment_request();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!schedules || !schedules.length) {
|
|
||||||
frappe.msgprint(__("No pending payment schedules available."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
schedules.forEach((schedule) => (schedule.__checked = 1));
|
schedules.forEach((schedule) => (schedule.__checked = 1));
|
||||||
|
|
||||||
const dialog = new frappe.ui.Dialog({
|
const dialog = new frappe.ui.Dialog({
|
||||||
@@ -833,26 +836,24 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
// for internal customer instead of pricing rule directly apply valuation rate on item
|
// for internal customer instead of pricing rule directly apply valuation rate on item
|
||||||
const fetch_valuation_rate_for_internal_transactions =
|
if (me.frm.doc.is_internal_customer || me.frm.doc.is_internal_supplier) {
|
||||||
await frappe.db.get_single_value(
|
const fetch_valuation_rate_for_internal_transactions =
|
||||||
"Accounts Settings",
|
await frappe.db.get_single_value(
|
||||||
"fetch_valuation_rate_for_internal_transaction"
|
"Accounts Settings",
|
||||||
);
|
"fetch_valuation_rate_for_internal_transaction"
|
||||||
if (
|
);
|
||||||
(me.frm.doc.is_internal_customer ||
|
if (fetch_valuation_rate_for_internal_transactions) {
|
||||||
me.frm.doc.is_internal_supplier) &&
|
me.get_incoming_rate(
|
||||||
fetch_valuation_rate_for_internal_transactions
|
item,
|
||||||
) {
|
me.frm.posting_date,
|
||||||
me.get_incoming_rate(
|
me.frm.posting_time,
|
||||||
item,
|
me.frm.doc.doctype,
|
||||||
me.frm.posting_date,
|
me.frm.doc.company
|
||||||
me.frm.posting_time,
|
);
|
||||||
me.frm.doc.doctype,
|
return;
|
||||||
me.frm.doc.company
|
}
|
||||||
);
|
|
||||||
} else {
|
|
||||||
me.frm.script_manager.trigger("price_list_rate", cdt, cdn);
|
|
||||||
}
|
}
|
||||||
|
me.frm.script_manager.trigger("price_list_rate", cdt, cdn);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if (me.frm.doc.is_internal_customer || me.frm.doc.is_internal_supplier) {
|
if (me.frm.doc.is_internal_customer || me.frm.doc.is_internal_supplier) {
|
||||||
|
|||||||
Reference in New Issue
Block a user