fix: key error during reposting
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index a6206ac..0370666 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -439,7 +439,7 @@
reposting_data = get_reposting_data(doc.reposting_data_file)
if reposting_data and reposting_data.distinct_item_and_warehouse:
- return reposting_data.distinct_item_and_warehouse
+ return parse_distinct_items_and_warehouses(reposting_data.distinct_item_and_warehouse)
distinct_item_warehouses = {}
@@ -457,6 +457,16 @@
return distinct_item_warehouses
+def parse_distinct_items_and_warehouses(distinct_items_and_warehouses):
+ new_dict = frappe._dict({})
+
+ # convert string keys to tuple
+ for k, v in distinct_items_and_warehouses.items():
+ new_dict[frappe.safe_eval(k)] = frappe._dict(v)
+
+ return new_dict
+
+
def get_affected_transactions(doc, reposting_data=None) -> Set[Tuple[str, str]]:
if not reposting_data and doc and doc.reposting_data_file:
reposting_data = get_reposting_data(doc.reposting_data_file)