[fix] validate_multi_currency

This commit is contained in:
Anand Doshi 2016-01-06 14:16:10 +05:30
parent 03e7e581d8
commit 4774c41958

View File

@ -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: