fix: Added patch and fallback code to prevent future issues similiar to helpdesk ticket 28246

(cherry picked from commit 65dc3505c4)

# Conflicts:
#	erpnext/patches.txt
This commit is contained in:
Mihir Kandoi
2024-12-31 12:53:30 +05:30
committed by Mergify
parent 85ba96e0f3
commit 66544bfa10
3 changed files with 41 additions and 0 deletions

View File

@@ -103,6 +103,16 @@ class SubcontractingController(StockController):
_("Row {0}: Item {1} must be a subcontracted item.").format(item.idx, item.item_name)
)
if (
not item.sc_conversion_factor
): # this condition will only be true if user has recently updated from develop branch
service_item_qty = frappe.get_value(
"Subcontracting Order Service Item",
filters={"purchase_order_item": item.purchase_order_item, "parent": self.name},
fieldname=["qty"],
)
item.sc_conversion_factor = service_item_qty / item.qty
if (
self.doctype not in "Subcontracting Receipt"
and item.qty