refactor(minor): rename function to be more descriptive
diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py
index 0575429..c3fa894 100644
--- a/erpnext/controllers/subcontracting_controller.py
+++ b/erpnext/controllers/subcontracting_controller.py
@@ -741,7 +741,7 @@
sco_doc = frappe.get_doc("Subcontracting Order", sco)
sco_doc.update_status()
- def set_missing_values_in_additional_costs(self):
+ def calculate_additional_costs(self):
self.total_additional_costs = sum(flt(item.amount) for item in self.get("additional_costs"))
if self.total_additional_costs:
diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py
index 0e6fe95..4ea4fd1 100644
--- a/erpnext/controllers/tests/test_subcontracting_controller.py
+++ b/erpnext/controllers/tests/test_subcontracting_controller.py
@@ -36,7 +36,7 @@
sco.remove_empty_rows()
self.assertEqual((len_before - 1), len(sco.service_items))
- def test_set_missing_values_in_additional_costs(self):
+ def test_calculate_additional_costs(self):
sco = get_subcontracting_order(do_not_submit=1)
rate_without_additional_cost = sco.items[0].rate
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
index e6de72d..3919733 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
+++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
@@ -77,22 +77,22 @@
frappe.throw(_(msg))
def set_missing_values(self):
- self.set_missing_values_in_additional_costs()
- self.set_missing_values_in_service_items()
- self.set_missing_values_in_supplied_items()
- self.set_missing_values_in_items()
+ self.calculate_additional_costs()
+ self.calculate_service_costs()
+ self.calculate_supplied_items_qty_and_amount()
+ self.calculate_items_qty_and_amount()
- def set_missing_values_in_service_items(self):
+ def calculate_service_costs(self):
for idx, item in enumerate(self.get("service_items")):
self.items[idx].service_cost_per_qty = item.amount / self.items[idx].qty
- def set_missing_values_in_supplied_items(self):
+ def calculate_supplied_items_qty_and_amount(self):
for item in self.get("items"):
bom = frappe.get_doc("BOM", item.bom)
rm_cost = sum(flt(rm_item.amount) for rm_item in bom.items)
item.rm_cost_per_qty = rm_cost / flt(bom.quantity)
- def set_missing_values_in_items(self):
+ def calculate_items_qty_and_amount(self):
total_qty = total = 0
for item in self.items:
item.rate = item.rm_cost_per_qty + item.service_cost_per_qty + flt(item.additional_cost_per_qty)
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
index 4f8e045..2c84262 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
@@ -113,9 +113,9 @@
@frappe.whitelist()
def set_missing_values(self):
- self.set_missing_values_in_additional_costs()
- self.set_missing_values_in_supplied_items()
- self.set_missing_values_in_items()
+ self.calculate_additional_costs()
+ self.calculate_supplied_items_qty_and_amount()
+ self.calculate_items_qty_and_amount()
def set_available_qty_for_consumption(self):
supplied_items_details = {}
@@ -147,13 +147,13 @@
item.rm_item_code, 0
)
- def set_missing_values_in_supplied_items(self):
+ def calculate_supplied_items_qty_and_amount(self):
for item in self.get("supplied_items") or []:
item.amount = item.rate * item.consumed_qty
self.set_available_qty_for_consumption()
- def set_missing_values_in_items(self):
+ def calculate_items_qty_and_amount(self):
rm_supp_cost = {}
for item in self.get("supplied_items") or []:
if item.reference_name in rm_supp_cost: