mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-31 23:33:43 +00:00
refactor!: change "is_subcontracted" field type from "Select" to "Check"
This commit is contained in:
@@ -2586,7 +2586,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
parent.update_ordered_qty()
|
||||
parent.update_ordered_and_reserved_qty()
|
||||
parent.update_receiving_percentage()
|
||||
if parent.is_subcontracted == "Yes":
|
||||
if parent.is_subcontracted:
|
||||
parent.update_reserved_qty_for_subcontract()
|
||||
parent.create_raw_materials_supplied("supplied_items")
|
||||
parent.save()
|
||||
|
||||
@@ -167,7 +167,7 @@ class BuyingController(StockController, Subcontracting):
|
||||
_("Row #{0}: Accepted Warehouse and Supplier Warehouse cannot be same").format(item.idx)
|
||||
)
|
||||
|
||||
if item.get("from_warehouse") and self.get("is_subcontracted") == "Yes":
|
||||
if item.get("from_warehouse") and self.get("is_subcontracted"):
|
||||
frappe.throw(
|
||||
_(
|
||||
"Row #{0}: Cannot select Supplier Warehouse while suppling raw materials to subcontractor"
|
||||
@@ -342,7 +342,7 @@ class BuyingController(StockController, Subcontracting):
|
||||
if not self.is_subcontracted and self.sub_contracted_items:
|
||||
frappe.throw(_("Please enter 'Is Subcontracted' as Yes or No"))
|
||||
|
||||
if self.is_subcontracted == "Yes":
|
||||
if self.is_subcontracted:
|
||||
if self.doctype in ["Purchase Receipt", "Purchase Invoice"] and not self.supplier_warehouse:
|
||||
frappe.throw(_("Supplier Warehouse mandatory for sub-contracted {0}").format(self.doctype))
|
||||
|
||||
@@ -363,14 +363,14 @@ class BuyingController(StockController, Subcontracting):
|
||||
item.bom = None
|
||||
|
||||
def create_raw_materials_supplied(self, raw_material_table):
|
||||
if self.is_subcontracted == "Yes":
|
||||
if self.is_subcontracted:
|
||||
self.set_materials_for_subcontracted_items(raw_material_table)
|
||||
|
||||
elif self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
|
||||
for item in self.get("items"):
|
||||
item.rm_supp_cost = 0.0
|
||||
|
||||
if self.is_subcontracted == "No" and self.get("supplied_items"):
|
||||
if not self.is_subcontracted and self.get("supplied_items"):
|
||||
self.set("supplied_items", [])
|
||||
|
||||
@property
|
||||
@@ -803,7 +803,7 @@ class BuyingController(StockController, Subcontracting):
|
||||
if self.doctype == "Material Request":
|
||||
return
|
||||
|
||||
if hasattr(self, "is_subcontracted") and self.is_subcontracted == "Yes":
|
||||
if hasattr(self, "is_subcontracted") and self.is_subcontracted:
|
||||
validate_item_type(self, "is_sub_contracted_item", "subcontracted")
|
||||
else:
|
||||
validate_item_type(self, "is_purchase_item", "purchase")
|
||||
|
||||
@@ -407,7 +407,7 @@ class Subcontracting:
|
||||
|
||||
def set_consumed_qty_in_po(self):
|
||||
# Update consumed qty back in the purchase order
|
||||
if self.is_subcontracted != "Yes":
|
||||
if not self.is_subcontracted:
|
||||
return
|
||||
|
||||
self.__get_purchase_orders()
|
||||
|
||||
Reference in New Issue
Block a user