From 17ac45c5c1d4ffd4e58c3b07ece9b46575c8fc42 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Thu, 7 Apr 2022 16:51:27 +0530 Subject: [PATCH 1/3] fix: dont reassign mutable (list) to a different field (cherry picked from commit fa4f57f470017f1bc762b4612bf289bd707aed25) # Conflicts: # erpnext/crm/doctype/opportunity/opportunity.py --- .../report/purchase_register/purchase_register.py | 10 +++++----- erpnext/crm/doctype/opportunity/opportunity.py | 6 ++++++ erpnext/selling/doctype/customer/customer.py | 3 ++- erpnext/selling/doctype/customer/test_customer.py | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index c35995931039..ed63e7f1d21d 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -124,11 +124,11 @@ def get_columns(invoice_list, additional_table_columns): _("Purchase Receipt") + ":Link/Purchase Receipt:100", {"fieldname": "currency", "label": _("Currency"), "fieldtype": "Data", "width": 80}, ] - expense_accounts = ( - tax_accounts - ) = ( - expense_columns - ) = tax_columns = unrealized_profit_loss_accounts = unrealized_profit_loss_account_columns = [] + + expense_accounts = [] + tax_accounts = [] + tax_columns = [] + unrealized_profit_loss_accounts = [] if invoice_list: expense_accounts = frappe.db.sql_list( diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index fc2053439248..1c91fa65a93e 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -109,7 +109,13 @@ def make_new_lead_if_required(self): @frappe.whitelist() def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None): if not self.has_active_quotation(): +<<<<<<< HEAD frappe.db.set(self, "status", "Lost") +======= + self.status = "Lost" + self.lost_reasons = [] + self.competitors = [] +>>>>>>> fa4f57f470 (fix: dont reassign mutable (list) to a different field) if detailed_reason: frappe.db.set(self, "order_lost_reason", detailed_reason) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 2e5cbb80cb61..8889a5f939af 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -100,7 +100,8 @@ def validate(self): @frappe.whitelist() def get_customer_group_details(self): doc = frappe.get_doc("Customer Group", self.customer_group) - self.accounts = self.credit_limits = [] + self.accounts = [] + self.credit_limits = [] self.payment_terms = self.default_price_list = "" tables = [["accounts", "account"], ["credit_limits", "credit_limit"]] diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 4979b8f976a7..f631a6ef5684 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -47,7 +47,8 @@ def test_get_customer_group_details(self): c_doc.customer_name = "Testing Customer" c_doc.customer_group = "_Testing Customer Group" c_doc.payment_terms = c_doc.default_price_list = "" - c_doc.accounts = c_doc.credit_limits = [] + c_doc.accounts = [] + c_doc.credit_limits = [] c_doc.insert() c_doc.get_customer_group_details() self.assertEqual(c_doc.payment_terms, "_Test Payment Term Template 3") From 3ea1bf2e091b195d8fd4da9d6b6a16bd99ef04cf Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Thu, 7 Apr 2022 17:01:10 +0530 Subject: [PATCH 2/3] fix: define tax_columns below consistency (cherry picked from commit 3b4754f3f68a41bd7b5c5fb46e838a8700ce057a) --- .../report/purchase_register/purchase_register.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index ed63e7f1d21d..a73c72c6d825 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -127,7 +127,6 @@ def get_columns(invoice_list, additional_table_columns): expense_accounts = [] tax_accounts = [] - tax_columns = [] unrealized_profit_loss_accounts = [] if invoice_list: @@ -163,10 +162,11 @@ def get_columns(invoice_list, additional_table_columns): unrealized_profit_loss_account_columns = [ (account + ":Currency/currency:120") for account in unrealized_profit_loss_accounts ] - - for account in tax_accounts: - if account not in expense_accounts: - tax_columns.append(account + ":Currency/currency:120") + tax_columns = [ + (account + ":Currency/currency:120") + for account in tax_accounts + if account not in expense_accounts + ] columns = ( columns From dbe5e919e5047fd0f5f925b138f16e42ad6fef88 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Thu, 7 Apr 2022 17:27:12 +0530 Subject: [PATCH 3/3] fix: merge conflict --- erpnext/crm/doctype/opportunity/opportunity.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 1c91fa65a93e..fc2053439248 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -109,13 +109,7 @@ def make_new_lead_if_required(self): @frappe.whitelist() def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None): if not self.has_active_quotation(): -<<<<<<< HEAD frappe.db.set(self, "status", "Lost") -======= - self.status = "Lost" - self.lost_reasons = [] - self.competitors = [] ->>>>>>> fa4f57f470 (fix: dont reassign mutable (list) to a different field) if detailed_reason: frappe.db.set(self, "order_lost_reason", detailed_reason)