refactor!: change "is_subcontracted" field type from "Select" to "Check"
This commit is contained in:
@@ -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"
|
||||
@@ -339,10 +339,7 @@ class BuyingController(StockController, Subcontracting):
|
||||
return supplied_items_cost
|
||||
|
||||
def validate_for_subcontracting(self):
|
||||
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 +360,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
|
||||
|
||||
Reference in New Issue
Block a user