fix: skip qty over-allowance check for non-stock items only

This commit is contained in:
pandiyan
2026-06-24 18:12:42 +05:30
parent 5c716b0547
commit bc313dc09d

View File

@@ -383,15 +383,17 @@ class StatusUpdater(Document):
def fetch_items_with_pending_qty(self, args, item_field, items):
doctype = frappe.qb.DocType(args["target_dt"])
item_field = doctype[item_field]
item_field_col = doctype[item_field]
target_ref_field = doctype[args["target_ref_field"]]
target_field = doctype[args["target_field"]]
return (
is_qty_check = "qty" in args["target_ref_field"]
query = (
frappe.qb.from_(doctype)
.select(
doctype.name,
item_field.as_("item_code"),
item_field_col.as_("item_code"),
target_ref_field,
target_field,
doctype.parenttype,
@@ -400,9 +402,18 @@ class StatusUpdater(Document):
.where(target_ref_field < target_field)
.where(doctype.name.isin(items))
.where(doctype.docstatus == 1)
.run(as_dict=True)
)
if is_qty_check:
item_table = frappe.qb.DocType("Item")
query = (
query.join(item_table)
.on(item_table.name == item_field_col)
.where(item_table.is_stock_item == 1)
)
return query.run(as_dict=True)
def check_overflow_with_allowance(self, item, args):
"""
Checks if there is overflow considering a relaxation allowance.