Try ERPNext Buy Support Partners Foundation Foundation Members

Error creating invoice after applying custom currency as default currency

I searched the best I can but cannot get a solution in the forum for my problem.

I’m running ERPnext V12.1.8 in multi-domain mode.
While creating a new instance, I have a custom currency that is not on the default setup list so what I did was choose something in the list which in this case was ZWD then before any transaction I created ZWL. I then changed default currency under ‘global defaults’ to the custom ZWL that I had just created

I added a new client and tried to create an invoice but what I get is the error:

Accounting Entry for Customer: test can only be made in currency: ZWD

Even if I go into customer details and change the default billing currency I still get same error when trying to create sales invoice.

Thank you in adavance

While investigating the currency error, I’ve looked at the code that raises the error

def validate_currency(self):
if self.get(“currency”):
party_type, party = self.get_party()
if party_type and party:
party_account_currency = get_party_account_currency(party_type, party, self.company)

			if (party_account_currency
					and party_account_currency != self.company_currency
					and self.currency != party_account_currency):
				frappe.throw(_("Accounting Entry for {0}: {1} can only be made in currency: {2}")
							 .format(party_type, party, party_account_currency), InvalidCurrency)

Then checked the code of the function that actually gets the currency, which is

def get_party_account_currency(party_type, party, company):
def generator():
party_account = get_party_account(party_type, party, company)
return frappe.db.get_value(“Account”, party_account, “account_currency”, cache=True)

return frappe.local_cache("party_account_currency", (party_type, party, company), generator)

Can anyone help me understand what the attribute ‘cache=True’ does or how it influences the returned value of the currency.

Any pointers will be greatly appreciated

I managed to solve this by going into the chart of accounts and manually changing Debtors currency to the custom one. I’m wondering shouldn’t all this happen automatically when you change the currency under global defaults