mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
Merge pull request #44585 from blaggacao/fix/old-data-from-2009-in-migration
fix: migration; make it resilient against old, non-conforming data
This commit is contained in:
@@ -26,7 +26,16 @@ def execute():
|
|||||||
updated_tax_details = {}
|
updated_tax_details = {}
|
||||||
needs_update = False
|
needs_update = False
|
||||||
|
|
||||||
for item, tax_data in json.loads(doc.item_wise_tax_detail).items():
|
try:
|
||||||
|
item_iterator = json.loads(doc.item_wise_tax_detail).items()
|
||||||
|
except AttributeError as e:
|
||||||
|
# This is stale data from 2009 found in a database
|
||||||
|
if isinstance(json.loads(doc.item_wise_tax_detail), int | float):
|
||||||
|
needs_update = False
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
for item, tax_data in item_iterator:
|
||||||
if isinstance(tax_data, list) and len(tax_data) == 2:
|
if isinstance(tax_data, list) and len(tax_data) == 2:
|
||||||
updated_tax_details[item] = ItemWiseTaxDetail(
|
updated_tax_details[item] = ItemWiseTaxDetail(
|
||||||
tax_rate=tax_data[0],
|
tax_rate=tax_data[0],
|
||||||
|
|||||||
Reference in New Issue
Block a user