fix: get value from dict (#44492)

`doc.taxes` is not always a `frappe._dict`, it can also be a regular `dict`. Resolves #44328
This commit is contained in:
Raffael Meyer
2024-12-03 20:03:57 +01:00
committed by GitHub
parent 483fd124fc
commit 657c85638c

View File

@@ -690,8 +690,8 @@ def is_within_valid_range(ctx: ItemDetailsCtx, tax) -> bool:
def get_item_tax_map(*, doc: str | dict | Document, tax_template: str | None = None, as_json=True):
doc = parse_json(doc)
item_tax_map = {}
for t in (t for t in (doc.get("taxes") or []) if not t.set_by_item_tax_template):
item_tax_map[t.account_head] = t.rate
for t in (t for t in (doc.get("taxes") or []) if not t.get("set_by_item_tax_template")):
item_tax_map[t.get("account_head")] = t.get("rate")
if tax_template:
template = frappe.get_cached_doc("Item Tax Template", tax_template)