fix(minor): Minor anti pattern fixes in Exchange rate revaluation doctype (#21147)
* fix(minor): Minor anti pattern fixes in Exchange rate revaluation doctype
* fix: Codacy
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
index 0d5456e..1092f4c 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
@@ -30,18 +30,10 @@
frm.doc.accounts.forEach(d=> {
total_amt = total_amt + d['new_balance_in_base_currency'];
});
- if(total_amt === r.sum) {
- frm.add_custom_button(__("Journal Entry"), function(){
- frappe.route_options = {
- 'reference_type': 'Exchange Rate Revaluation',
- 'reference_name': frm.doc.name
- };
- frappe.set_route("List", "Journal Entry");
- }, __("View"));
- } else {
- frm.add_custom_button(__('Create Journal Entry'), function() {
+ if(total_amt !== r.sum) {
+ frm.add_custom_button(__('Journal Entry'), function() {
return frm.events.make_jv(frm);
- });
+ }, __('Create'));
}
}, 'Journal Entry');
}
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
new file mode 100644
index 0000000..b5cfa04
--- /dev/null
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
@@ -0,0 +1,11 @@
+from __future__ import unicode_literals
+
+def get_data():
+ return {
+ 'fieldname': 'reference_name',
+ 'transactions': [
+ {
+ 'items': ['Journal Entry']
+ }
+ ]
+ }