diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index a6029561efd..670661c01fa 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: