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
This commit is contained in:
Deepesh Garg 2020-04-06 10:21:50 +05:30 committed by GitHub
parent 05ac7213b3
commit 1958749382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -30,18 +30,10 @@ frappe.ui.form.on('Exchange Rate Revaluation', {
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');
}

View File

@ -0,0 +1,11 @@
from __future__ import unicode_literals
def get_data():
return {
'fieldname': 'reference_name',
'transactions': [
{
'items': ['Journal Entry']
}
]
}