Merge pull request #51048 from aerele/fetch-exchange-gain-loss-account

fix(payment entry): fetch gain loss account from company boot
This commit is contained in:
ruthra kumar
2025-12-16 16:27:35 +05:30
committed by GitHub
2 changed files with 4 additions and 5 deletions

View File

@@ -1277,15 +1277,14 @@ frappe.ui.form.on("Payment Entry", {
let row = (frm.doc.deductions || []).find((t) => t.is_exchange_gain_loss); let row = (frm.doc.deductions || []).find((t) => t.is_exchange_gain_loss);
if (!row) { if (!row) {
const response = await get_company_defaults(frm.doc.company); const company_defaults = frappe.get_doc(":Company", frm.doc.company);
const account = const account =
response.message?.[account_fieldname] || company_defaults?.[account_fieldname] ||
(await prompt_for_missing_account(frm, account_fieldname)); (await prompt_for_missing_account(frm, account_fieldname));
row = frm.add_child("deductions"); row = frm.add_child("deductions");
row.account = account; row.account = account;
row.cost_center = response.message?.cost_center; row.cost_center = company_defaults?.cost_center;
row.is_exchange_gain_loss = 1; row.is_exchange_gain_loss = 1;
} }

View File

@@ -49,7 +49,7 @@ def boot_session(bootinfo):
bootinfo.docs += frappe.db.sql( bootinfo.docs += frappe.db.sql(
"""select name, default_currency, cost_center, default_selling_terms, default_buying_terms, """select name, default_currency, cost_center, default_selling_terms, default_buying_terms,
default_letter_head, default_bank_account, enable_perpetual_inventory, country from `tabCompany`""", default_letter_head, default_bank_account, enable_perpetual_inventory, country, exchange_gain_loss_account from `tabCompany`""",
as_dict=1, as_dict=1,
update={"doctype": ":Company"}, update={"doctype": ":Company"},
) )