Merge pull request #23989 from Anurag810/item-maintain-stock-fixes
fix: maintain stock can't be changed it there is product bundle
This commit is contained in:
commit
ccd554c19c
@ -977,15 +977,20 @@ class Item(WebsiteGenerator):
|
|||||||
# For "Is Stock Item", following doctypes is important
|
# For "Is Stock Item", following doctypes is important
|
||||||
# because reserved_qty, ordered_qty and requested_qty updated from these doctypes
|
# because reserved_qty, ordered_qty and requested_qty updated from these doctypes
|
||||||
if field == "is_stock_item":
|
if field == "is_stock_item":
|
||||||
linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"]
|
linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item", "Product Bundle"]
|
||||||
|
|
||||||
for doctype in linked_doctypes:
|
for doctype in linked_doctypes:
|
||||||
|
filters={"item_code": self.name, "docstatus": 1}
|
||||||
|
|
||||||
|
if doctype == "Product Bundle":
|
||||||
|
filters={"new_item_code": self.name}
|
||||||
|
|
||||||
if doctype in ("Purchase Invoice Item", "Sales Invoice Item",):
|
if doctype in ("Purchase Invoice Item", "Sales Invoice Item",):
|
||||||
# If Invoice has Stock impact, only then consider it.
|
# If Invoice has Stock impact, only then consider it.
|
||||||
if self.stock_ledger_created():
|
if self.stock_ledger_created():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}):
|
elif frappe.db.get_value(doctype, filters):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def validate_auto_reorder_enabled_in_stock_settings(self):
|
def validate_auto_reorder_enabled_in_stock_settings(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user