fix: alternative item not working for subcontract (#22386)
(cherry picked from commit 171699537c3e7d7632f45123c6d30012c8de7281) Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
This commit is contained in:
parent
3dee5273d6
commit
ca8894b0fc
@ -574,9 +574,7 @@ class StockEntry(StockController):
|
||||
{"parent": self.purchase_order, "item_code": se_item.subcontracted_item},
|
||||
"bom")
|
||||
|
||||
allow_alternative_item = frappe.get_value("BOM", bom_no, "allow_alternative_item")
|
||||
|
||||
if allow_alternative_item:
|
||||
if se_item.allow_alternative_item:
|
||||
original_item_code = frappe.get_value("Item Alternative", {"alternative_item_code": item_code}, "item_code")
|
||||
|
||||
required_qty = sum([flt(d.required_qty) for d in purchase_order.supplied_items \
|
||||
@ -743,7 +741,7 @@ class StockEntry(StockController):
|
||||
|
||||
def get_item_details(self, args=None, for_update=False):
|
||||
item = frappe.db.sql("""select i.name, i.stock_uom, i.description, i.image, i.item_name, i.item_group,
|
||||
i.has_batch_no, i.sample_quantity, i.has_serial_no,
|
||||
i.has_batch_no, i.sample_quantity, i.has_serial_no, i.allow_alternative_item,
|
||||
id.expense_account, id.buying_cost_center
|
||||
from `tabItem` i LEFT JOIN `tabItem Default` id ON i.name=id.parent and id.company=%s
|
||||
where i.name=%s
|
||||
@ -778,6 +776,9 @@ class StockEntry(StockController):
|
||||
'expense_account' : item.expense_account
|
||||
})
|
||||
|
||||
if self.purpose == 'Send to Subcontractor':
|
||||
ret["allow_alternative_item"] = item.allow_alternative_item
|
||||
|
||||
# update uom
|
||||
if args.get("uom") and for_update:
|
||||
ret.update(get_uom_details(args.get('item_code'), args.get('uom'), args.get('qty')))
|
||||
|
Loading…
Reference in New Issue
Block a user