From 4774c419586a52f2dfd7593850a89338e7422e04 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 6 Jan 2016 14:16:10 +0530 Subject: [PATCH] [fix] validate_multi_currency --- .../accounts/doctype/journal_entry/journal_entry.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index a6029561ef..670661c01f 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -104,7 +104,7 @@ class JournalEntry(AccountsController): msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this is an advance entry.").format(d.idx, d.account)) elif d.reference_type in ("Sales Order", "Purchase Order") and d.is_advance != "Yes": frappe.throw(_("Row {0}: Payment against Sales/Purchase Order should always be marked as advance").format(d.idx)) - + if d.is_advance == "Yes": if d.party_type == 'Customer' and flt(d.debit) > 0: frappe.throw(_("Row {0}: Advance against Customer must be credit").format(d.idx)) @@ -280,10 +280,14 @@ class JournalEntry(AccountsController): alternate_currency = [] for d in self.get("accounts"): account = frappe.db.get_value("Account", d.account, ["account_currency", "account_type"], as_dict=1) - d.account_currency = account.account_currency or self.company_currency - d.account_type = account.account_type + if account: + d.account_currency = account.account_currency + d.account_type = account.account_type - if d.account_currency!=self.company_currency and d.account_currency not in alternate_currency: + if not d.account_currency: + d.account_currency = self.company_currency + + if d.account_currency != self.company_currency and d.account_currency not in alternate_currency: alternate_currency.append(d.account_currency) if alternate_currency: