From 6c173e97302c44936d97c99a80742b503b0a4c39 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 30 Nov 2015 16:07:43 +0530 Subject: [PATCH] [fix] Total Amount in Journal Entry in bank currency --- .../doctype/journal_entry/journal_entry.json | 52 +++++++++++++++++-- .../doctype/journal_entry/journal_entry.py | 12 +++-- erpnext/patches.txt | 2 +- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 123724532e..6890b50307 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -24,6 +24,7 @@ "options": "icon-flag", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -48,6 +49,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -74,6 +76,7 @@ "options": "Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -99,6 +102,7 @@ "options": "JV-", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -121,6 +125,7 @@ "oldfieldtype": "Column Break", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -146,6 +151,7 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -170,6 +176,7 @@ "options": "icon-table", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -195,6 +202,7 @@ "options": "Journal Entry Account", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -216,6 +224,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -241,6 +250,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -265,6 +275,7 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -289,6 +300,7 @@ "oldfieldtype": "Small Text", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -310,6 +322,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -335,6 +348,7 @@ "options": "Company:company:default_currency", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -360,6 +374,7 @@ "options": "Company:company:default_currency", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -386,6 +401,7 @@ "options": "Company:company:default_currency", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -410,6 +426,7 @@ "oldfieldtype": "Button", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -433,6 +450,7 @@ "permlevel": 0, "precision": "", "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -453,9 +471,10 @@ "label": "Total Amount", "length": 0, "no_copy": 1, - "options": "Company:company:default_currency", + "options": "", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 1, "reqd": 0, @@ -478,6 +497,7 @@ "no_copy": 1, "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 1, "reqd": 0, @@ -501,6 +521,7 @@ "options": "icon-pushpin", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -525,6 +546,7 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -550,6 +572,7 @@ "oldfieldtype": "Small Text", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -571,6 +594,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -595,6 +619,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -619,6 +644,7 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -643,6 +669,7 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -667,6 +694,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -692,6 +720,7 @@ "options": "Accounts Receivable\nAccounts Payable", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -716,6 +745,7 @@ "options": "get_outstanding_invoices", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -738,6 +768,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -762,6 +793,7 @@ "options": "Company:company:default_currency", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -785,6 +817,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -807,6 +840,7 @@ "no_copy": 1, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -829,6 +863,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -852,6 +887,7 @@ "options": "Letter Head", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -877,6 +913,7 @@ "options": "Print Heading", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -901,6 +938,7 @@ "options": "icon-file-text", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -926,6 +964,7 @@ "options": "Company", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -951,6 +990,7 @@ "options": "Fiscal Year", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -973,6 +1013,7 @@ "oldfieldtype": "Column Break", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -1001,6 +1042,7 @@ "options": "No\nYes", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -1026,6 +1068,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -1051,6 +1094,7 @@ "options": "Journal Entry", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -1069,7 +1113,8 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:48.813805", + "menu_index": 0, + "modified": "2015-11-30 16:11:45.556341", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry", @@ -1141,5 +1186,6 @@ "search_fields": "voucher_type,posting_date, due_date, cheque_no", "sort_field": "modified", "sort_order": "DESC", - "title_field": "title" + "title_field": "title", + "version": 0 } \ No newline at end of file diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 3edd4be3fa..eefa0db1bb 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -340,6 +340,7 @@ class JournalEntry(AccountsController): def set_print_format_fields(self): total_amount = 0.0 + bank_account_currency = None for d in self.get('accounts'): if d.party_type and d.party: if not self.pay_to_recd_from: @@ -347,14 +348,15 @@ class JournalEntry(AccountsController): "customer_name" if d.party_type=="Customer" else "supplier_name") elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]: - total_amount += (d.debit or d.credit) + total_amount += (d.debit_in_account_currency or d.credit_in_account_currency) + bank_account_currency = d.account_currency + + self.set_total_amount(total_amount, bank_account_currency) - self.set_total_amount(total_amount) - - def set_total_amount(self, amt): + def set_total_amount(self, amt, currency): self.total_amount = amt from frappe.utils import money_in_words - self.total_amount_in_words = money_in_words(amt, self.company_currency) + self.total_amount_in_words = money_in_words(amt, currency) def make_gl_entries(self, cancel=0, adv_adj=0): from erpnext.accounts.general_ledger import make_gl_entries diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3675924cdb..97d1d933ef 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -235,5 +235,5 @@ execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility") erpnext.patches.v6_8.make_webform_standard #2015-11-23 erpnext.patches.v6_8.move_drop_ship_to_po_items erpnext.patches.v6_10.fix_ordered_received_billed -erpnext.patches.v6_10.fix_jv_total_amount #2015-11-28 +erpnext.patches.v6_10.fix_jv_total_amount #2015-11-30 erpnext.patches.v6_10.email_digest_default_quote