From 0070b5ef9afecfc0ab586acf809d0c50b9f77e03 Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Thu, 17 Nov 2022 17:46:49 +0530 Subject: [PATCH] fix: use `list()` on self mutating iteration https://github.com/frappe/erpnext/issues/30325 Signed-off-by: Sabu Siyad (cherry picked from commit 546c809cbeead2b556b3b09b632f3d73a500900e) --- erpnext/erpnext_integrations/taxjar_integration.py | 2 +- erpnext/stock/report/stock_ledger/stock_ledger.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py index b8893aa7732..2d9093b6e92 100644 --- a/erpnext/erpnext_integrations/taxjar_integration.py +++ b/erpnext/erpnext_integrations/taxjar_integration.py @@ -302,7 +302,7 @@ def check_for_nexus(doc, tax_dict): item.tax_collectable = flt(0) item.taxable_amount = flt(0) - for tax in doc.taxes: + for tax in list(doc.taxes): if tax.account_head == TAX_ACCOUNT_HEAD: doc.taxes.remove(tax) return diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py index b1fdaacac9d..7ca771f0a73 100644 --- a/erpnext/stock/report/stock_ledger/stock_ledger.py +++ b/erpnext/stock/report/stock_ledger/stock_ledger.py @@ -355,7 +355,7 @@ def get_opening_balance(filters, columns, sl_entries): ) # check if any SLEs are actually Opening Stock Reconciliation - for sle in sl_entries: + for sle in list(sl_entries): if ( sle.get("voucher_type") == "Stock Reconciliation" and sle.get("date").split()[0] == filters.from_date