Revert "fix: get `consumed_qty` based on `received_qty` in SCR"
This reverts commit 70c9b8dc50d77f7bbc3da7f7341c3e6432902a0d.
diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py
index 7819fa5..8d67e30 100644
--- a/erpnext/controllers/subcontracting_controller.py
+++ b/erpnext/controllers/subcontracting_controller.py
@@ -100,7 +100,7 @@
and self._doc_before_save
):
for row in self._doc_before_save.get("items"):
- item_dict[row.name] = (row.item_code, row.received_qty or row.qty)
+ item_dict[row.name] = (row.item_code, row.qty)
return item_dict
@@ -118,9 +118,7 @@
for row in self.items:
self.__reference_name.append(row.name)
- if (row.name not in item_dict) or (row.item_code, row.received_qty or row.qty) != item_dict[
- row.name
- ]:
+ if (row.name not in item_dict) or (row.item_code, row.qty) != item_dict[row.name]:
self.__changed_name.append(row.name)
if item_dict.get(row.name):
@@ -463,13 +461,12 @@
def __get_qty_based_on_material_transfer(self, item_row, transfer_item):
key = (item_row.item_code, item_row.get(self.subcontract_data.order_field))
- item_qty = item_row.received_qty or item_row.qty
- if self.qty_to_be_received.get(key) == item_qty:
+ if self.qty_to_be_received == item_row.qty:
return transfer_item.qty
if self.qty_to_be_received:
- qty = (flt(item_qty) * flt(transfer_item.qty)) / flt(self.qty_to_be_received.get(key, 0))
+ qty = (flt(item_row.qty) * flt(transfer_item.qty)) / flt(self.qty_to_be_received.get(key, 0))
transfer_item.item_details.required_qty = transfer_item.qty
if transfer_item.serial_no or frappe.get_cached_value(
@@ -494,11 +491,7 @@
for bom_item in self.__get_materials_from_bom(
row.item_code, row.bom, row.get("include_exploded_items")
):
- qty = (
- flt(bom_item.qty_consumed_per_unit)
- * flt(row.received_qty or row.qty)
- * row.conversion_factor
- )
+ qty = flt(bom_item.qty_consumed_per_unit) * flt(row.qty) * row.conversion_factor
bom_item.main_item_code = row.item_code
self.__update_reserve_warehouse(bom_item, row)
self.__set_alternative_item(bom_item)