From 150728deaaaf0ceb13c567d22f9c0910015245d6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 22 Sep 2023 11:30:47 +0530 Subject: [PATCH] refactor: button on PE to filter associated Journals --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 6 ++++++ erpnext/public/js/utils/unreconcile.js | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 794a4ef1bc02..0203c450583e 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -154,6 +154,12 @@ frappe.ui.form.on('Payment Entry', { frm.events.set_dynamic_labels(frm); frm.events.show_general_ledger(frm); erpnext.accounts.ledger_preview.show_accounting_ledger_preview(frm); + if(frm.doc.references.find((elem) => {return elem.exchange_gain_loss != 0})) { + frm.add_custom_button(__("View Exchange Gain/Loss Journals"), function() { + frappe.set_route("List", "Journal Entry", {"voucher_type": "Exchange Gain Or Loss", "reference_name": frm.doc.name}); + }, __('Actions')); + + } erpnext.accounts.unreconcile_payments.add_unreconcile_btn(frm); }, diff --git a/erpnext/public/js/utils/unreconcile.js b/erpnext/public/js/utils/unreconcile.js index bbdd51d6e54a..fa00ed23620c 100644 --- a/erpnext/public/js/utils/unreconcile.js +++ b/erpnext/public/js/utils/unreconcile.js @@ -17,7 +17,7 @@ erpnext.accounts.unreconcile_payments = { }, callback: function(r) { if (r.message) { - frm.add_custom_button(__("Un-Reconcile"), function() { + frm.add_custom_button(__("UnReconcile"), function() { erpnext.accounts.unreconcile_payments.build_unreconcile_dialog(frm); }, __('Actions')); } @@ -87,11 +87,11 @@ erpnext.accounts.unreconcile_payments = { unreconcile_dialog_fields[0].get_data = function(){ return r.message}; let d = new frappe.ui.Dialog({ - title: 'Un-Reconcile Allocations', + title: 'UnReconcile Allocations', fields: unreconcile_dialog_fields, size: 'large', cannot_add_rows: true, - primary_action_label: 'Un-Reconcile', + primary_action_label: 'UnReconcile', primary_action(values) { let selected_allocations = values.allocations.filter(x=>x.__checked);