From d487bf77e1d483c54bd1a5f6f30c9c60b20f4840 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 9 Feb 2017 12:36:44 +0530 Subject: [PATCH] [minor] payment entry company trigger --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index d3dbd314cc..2a2f9fff55 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -79,8 +79,13 @@ frappe.ui.form.on('Payment Entry', { frm.events.show_general_ledger(frm); }, + company: function(frm) { + frm.events.hide_unhide_fields(frm); + frm.events.set_dynamic_labels(frm); + }, + hide_unhide_fields: function(frm) { - var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; + var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: ""; frm.toggle_display("source_exchange_rate", (frm.doc.paid_amount && frm.doc.paid_from_account_currency != company_currency)); @@ -118,7 +123,7 @@ frappe.ui.form.on('Payment Entry', { }, set_dynamic_labels: function(frm) { - var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency; + var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: ""; frm.set_currency_labels(["base_paid_amount", "base_received_amount", "base_total_allocated_amount", "difference_amount"], company_currency);