fix: dont reassign mutable (list) to a different field

This commit is contained in:
Sagar Vora 2022-04-07 16:51:27 +05:30
parent 18b1a93c7e
commit fa4f57f470
4 changed files with 11 additions and 8 deletions

View File

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

View File

@ -126,7 +126,8 @@ class Opportunity(TransactionBase):
def declare_enquiry_lost(self, lost_reasons_list, competitors, detailed_reason=None):
if not self.has_active_quotation():
self.status = "Lost"
self.lost_reasons = self.competitors = []
self.lost_reasons = []
self.competitors = []
if detailed_reason:
self.order_lost_reason = detailed_reason

View File

@ -100,7 +100,8 @@ class Customer(TransactionBase):
@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"]]

View File

@ -45,7 +45,8 @@ class TestCustomer(FrappeTestCase):
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")