From 3806d8cf3a337b443164f8b00dd9cb7de36416ef Mon Sep 17 00:00:00 2001 From: David Date: Sat, 23 Nov 2024 19:08:02 +0100 Subject: [PATCH] fixup! fix: tax_item_rate calculation --- erpnext/public/js/controllers/transaction.js | 2 +- erpnext/stock/get_item_details.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index bce42132e981b..e1031743ad6f8 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -2108,7 +2108,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe return this.frm.call({ method: "erpnext.stock.get_item_details.get_item_tax_map", args: { - company: me.frm.doc.company, + doc: me.frm.doc, item_tax_template: item.item_tax_template, as_json: true }, diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index b14ea36884aac..8809e0e3d25d5 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -687,9 +687,10 @@ def is_within_valid_range(ctx: ItemDetailsCtx, tax) -> bool: @frappe.whitelist() -def get_item_tax_map(*, doc: dict | Document, tax_template: str | None = None, as_json=True): +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", []) if not t.set_by_item_tax_template): + 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 if tax_template: