diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py index 51840d49989..84a65160135 100644 --- a/erpnext/controllers/subcontracting_controller.py +++ b/erpnext/controllers/subcontracting_controller.py @@ -103,6 +103,16 @@ class SubcontractingController(StockController): _("Row {0}: Item {1} must be a subcontracted item.").format(item.idx, item.item_name) ) + if ( + self.doctype == "Subcontracting Order" and 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 diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9b4dd738d84..5fe116657fa 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -393,4 +393,4 @@ erpnext.patches.v15_0.set_is_exchange_gain_loss_in_payment_entry_deductions erpnext.patches.v14_0.update_stock_uom_in_work_order_item erpnext.patches.v15_0.enable_allow_existing_serial_no erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts -erpnext.patches.v15_0.refactor_closing_stock_balance #5 +erpnext.patches.v15_0.refactor_closing_stock_balance #5 \ No newline at end of file