From c83fbd5c50da1e2da9ff5ce6f33a171a11e896a0 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 11 Jul 2022 13:43:01 +0530 Subject: [PATCH 1/3] fix: Allow multi currency invoice against single party account --- .../doctype/accounts_settings/accounts_settings.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index 417611fecdd..3e0b82c5610 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -18,6 +18,7 @@ "automatically_fetch_payment_terms", "column_break_17", "enable_common_party_accounting", + "allow_multi_currency_invoices_against_single_party_account", "report_setting_section", "use_custom_cash_flow", "deferred_accounting_settings_section", @@ -339,6 +340,13 @@ "fieldname": "report_setting_section", "fieldtype": "Section Break", "label": "Report Setting" + }, + { + "default": "0", + "description": "Enabling this will allow creation of multi-currency invoices against single party account in company currency", + "fieldname": "allow_multi_currency_invoices_against_single_party_account", + "fieldtype": "Check", + "label": "Allow multi-currency invoices against single party account " } ], "icon": "icon-cog", @@ -346,7 +354,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2022-04-08 14:45:06.796418", + "modified": "2022-07-11 13:37:50.605141", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", From 3cf609fab18c532bb8c404a9024b802d82d7d7fe Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 11 Jul 2022 13:46:59 +0530 Subject: [PATCH 2/3] chore: Ignore validation --- erpnext/controllers/accounts_controller.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index ceac815bf4a..19875faacbb 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1472,8 +1472,15 @@ class AccountsController(TransactionBase): self.get("debit_to") if self.doctype == "Sales Invoice" else self.get("credit_to") ) party_account_currency = get_account_currency(party_account) + allow_multi_currency_invoices_against_single_party_account = frappe.get_single_value( + "Accounts Settings", "allow_multi_currency_invoices_against_single_party_account" + ) - if not party_gle_currency and (party_account_currency != self.currency): + if ( + not party_gle_currency + and (party_account_currency != self.currency) + and not allow_multi_currency_invoices_against_single_party_account + ): frappe.throw( _("Party Account {0} currency ({1}) and document currency ({2}) should be same").format( frappe.bold(party_account), party_account_currency, self.currency From e04e67c6bf067128d5a5a46e3d6e6fb93531c8b8 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 11 Jul 2022 19:25:18 +0530 Subject: [PATCH 3/3] chore: fix query --- erpnext/controllers/accounts_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 19875faacbb..df80ef5bfba 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1472,7 +1472,7 @@ class AccountsController(TransactionBase): self.get("debit_to") if self.doctype == "Sales Invoice" else self.get("credit_to") ) party_account_currency = get_account_currency(party_account) - allow_multi_currency_invoices_against_single_party_account = frappe.get_single_value( + allow_multi_currency_invoices_against_single_party_account = frappe.db.get_singles_value( "Accounts Settings", "allow_multi_currency_invoices_against_single_party_account" )