refactor: use frappe._dict in importers of ItemDetailsCtx

Extend the boundary rule to callers: non-decorated code that built or
annotated with ItemDetailsCtx now uses frappe._dict directly, and drops
the now-unused import. asset_capitalization keeps ItemDetailsCtx for its
own normalize_ctx_input-decorated functions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mihir Kandoi
2026-07-01 16:30:16 +05:30
parent 9406ec49de
commit e6f8f8f7e9
17 changed files with 40 additions and 45 deletions

View File

@@ -47,7 +47,6 @@ from erpnext.controllers.sales_and_purchase_return import validate_return
from erpnext.setup.utils import get_exchange_rate
from erpnext.stock.doctype.item.item import get_uom_conv_factor
from erpnext.stock.get_item_details import (
ItemDetailsCtx,
get_item_details,
)
from erpnext.utilities.regional import temporary_flag
@@ -782,7 +781,7 @@ class AccountsController(TransactionBase):
for item in self.get("items"):
if item.get("item_code"):
ctx: ItemDetailsCtx = ItemDetailsCtx(parent_dict.copy())
ctx: frappe._dict = frappe._dict(parent_dict.copy())
ctx.update(item.as_dict())
ctx.update(

View File

@@ -25,7 +25,7 @@ from pypika import Order
import erpnext
from erpnext.accounts.utils import build_qb_match_conditions
from erpnext.stock.get_item_details import ItemDetailsCtx, _get_item_tax_template
from erpnext.stock.get_item_details import _get_item_tax_template
from erpnext.stock.utils import get_combine_datetime
from erpnext.utilities.query import get_filter_conditions_qb
@@ -1056,7 +1056,7 @@ def get_tax_template(doctype: str, txt: str, searchfield: str, start: int, page_
valid_from = filters.get("valid_from")
valid_from = valid_from[1] if isinstance(valid_from, list) else valid_from
ctx = ItemDetailsCtx(
ctx = frappe._dict(
{
"item_code": filters.get("item_code"),
"posting_date": valid_from,

View File

@@ -21,7 +21,6 @@ from erpnext.controllers.accounts_controller import (
from erpnext.deprecation_dumpster import deprecated
from erpnext.stock.get_item_details import (
NOT_APPLICABLE_TAX,
ItemDetailsCtx,
_get_item_tax_template,
get_item_tax_map,
)
@@ -99,7 +98,7 @@ class calculate_taxes_and_totals:
for item in self.doc.items:
if item.item_code and item.get("item_tax_template"):
item_doc = frappe.get_cached_doc("Item", item.item_code)
ctx = ItemDetailsCtx(
ctx = frappe._dict(
{
"net_rate": item.net_rate or item.rate,
"base_net_rate": item.base_net_rate or item.base_rate,