From 9ac9c46dab24126381d868fb71c0215a133005db Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 11 Jul 2022 13:43:01 +0530 Subject: [PATCH 1/4] fix: Allow multi currency invoice against single party account (cherry picked from commit c83fbd5c50da1e2da9ff5ce6f33a171a11e896a0) # Conflicts: # erpnext/accounts/doctype/accounts_settings/accounts_settings.json --- .../accounts_settings/accounts_settings.json | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index baab628b210..f35ded657eb 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -19,6 +19,7 @@ "book_asset_depreciation_entry_automatically", "unlink_advance_payment_on_cancelation_of_order", "enable_common_party_accounting", +<<<<<<< HEAD "post_change_gl_entries", "enable_discount_accounting", "tax_settings_section", @@ -30,6 +31,11 @@ "frozen_accounts_modifier", "column_break_4", "credit_controller", +======= + "allow_multi_currency_invoices_against_single_party_account", + "report_setting_section", + "use_custom_cash_flow", +>>>>>>> c83fbd5c50 (fix: Allow multi currency invoice against single party account) "deferred_accounting_settings_section", "book_deferred_entries_based_on", "column_break_18", @@ -272,10 +278,37 @@ "label": "Enable Discount Accounting" }, { +<<<<<<< HEAD "default": "0", "fieldname": "enable_common_party_accounting", "fieldtype": "Check", "label": "Enable Common Party Accounting" +======= + "fieldname": "invoicing_features_section", + "fieldtype": "Section Break", + "label": "Invoicing Features" + }, + { + "fieldname": "column_break_17", + "fieldtype": "Column Break" + }, + { + "fieldname": "pos_tab", + "fieldtype": "Tab Break", + "label": "POS" + }, + { + "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 " +>>>>>>> c83fbd5c50 (fix: Allow multi currency invoice against single party account) } ], "icon": "icon-cog", @@ -283,7 +316,11 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], +<<<<<<< HEAD "modified": "2021-10-11 17:42:36.427699", +======= + "modified": "2022-07-11 13:37:50.605141", +>>>>>>> c83fbd5c50 (fix: Allow multi currency invoice against single party account) "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", From 66c5290deec595d30ad093d87afa0a9fb7f88e22 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 11 Jul 2022 13:46:59 +0530 Subject: [PATCH 2/4] chore: Ignore validation (cherry picked from commit 3cf609fab18c532bb8c404a9024b802d82d7d7fe) --- 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 dce6d7525d0..b049996056f 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1470,8 +1470,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 1c686c732ea85546648c054669a41d6affe6a62e Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 11 Jul 2022 19:25:18 +0530 Subject: [PATCH 3/4] chore: fix query (cherry picked from commit e04e67c6bf067128d5a5a46e3d6e6fb93531c8b8) --- 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 b049996056f..4eee74b2cbd 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1470,7 +1470,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" ) From 0a5bc86d1bc917dde27e5eab7466f45c5cdc4411 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Thu, 14 Jul 2022 17:20:32 +0530 Subject: [PATCH 4/4] chore: resolve conflicts --- .../accounts_settings/accounts_settings.json | 43 +++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index f35ded657eb..ea427aa7d80 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -19,7 +19,7 @@ "book_asset_depreciation_entry_automatically", "unlink_advance_payment_on_cancelation_of_order", "enable_common_party_accounting", -<<<<<<< HEAD + "allow_multi_currency_invoices_against_single_party_account", "post_change_gl_entries", "enable_discount_accounting", "tax_settings_section", @@ -31,11 +31,6 @@ "frozen_accounts_modifier", "column_break_4", "credit_controller", -======= - "allow_multi_currency_invoices_against_single_party_account", - "report_setting_section", - "use_custom_cash_flow", ->>>>>>> c83fbd5c50 (fix: Allow multi currency invoice against single party account) "deferred_accounting_settings_section", "book_deferred_entries_based_on", "column_break_18", @@ -278,49 +273,25 @@ "label": "Enable Discount Accounting" }, { -<<<<<<< HEAD "default": "0", "fieldname": "enable_common_party_accounting", "fieldtype": "Check", "label": "Enable Common Party Accounting" -======= - "fieldname": "invoicing_features_section", - "fieldtype": "Section Break", - "label": "Invoicing Features" }, { - "fieldname": "column_break_17", - "fieldtype": "Column Break" - }, - { - "fieldname": "pos_tab", - "fieldtype": "Tab Break", - "label": "POS" - }, - { - "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 " ->>>>>>> c83fbd5c50 (fix: Allow multi currency invoice against single party account) - } + "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", "idx": 1, "index_web_pages_for_search": 1, "issingle": 1, "links": [], -<<<<<<< HEAD - "modified": "2021-10-11 17:42:36.427699", -======= "modified": "2022-07-11 13:37:50.605141", ->>>>>>> c83fbd5c50 (fix: Allow multi currency invoice against single party account) "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings",