diff --git a/aumms/aumms_manufacturing/doctype/jewellery_order/jewellery_order.js b/aumms/aumms_manufacturing/doctype/jewellery_order/jewellery_order.js index f5806656..7b4bb395 100644 --- a/aumms/aumms_manufacturing/doctype/jewellery_order/jewellery_order.js +++ b/aumms/aumms_manufacturing/doctype/jewellery_order/jewellery_order.js @@ -77,7 +77,6 @@ frappe.ui.form.on("Jewellery Order Item", { is_available: function(frm, cdt, cdn) { let all_finished = true; let total_weightage = 0; - let total_qty = 0; let childtable = frm.doc.jewellery_order_items || []; for (let i = 0; i < childtable.length; i++) { if (childtable[i].is_available) { @@ -87,12 +86,6 @@ frappe.ui.form.on("Jewellery Order Item", { all_finished = false; } } - if (frm.doc.jewellery_order_items) { - total_qty = frm.doc.jewellery_order_items.filter(function(row) { - return row.is_available == 1; - }).length; - } - frm.set_value('available_item_quantity', total_qty); frm.set_value('finished', all_finished ? 1 : 0); frm.set_value('weight_of_available_item', total_weightage); update_available_item_quantity(frm); diff --git a/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.json b/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.json index 8c64da4f..036c9fed 100644 --- a/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.json +++ b/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.json @@ -8,15 +8,15 @@ "field_order": [ "title", "request_from", + "raw_material_request", "jewellery_order_item", "column_break_i3eg", "jewellery_order", "manufacturing_request", - "raw_material_request", "required_date", "section_break_hpbr", "type", - "category", + "quantity", "posting_date", "posting_time", "column_break_ky2t", @@ -28,7 +28,7 @@ "weight", "keep_metal_ledger", "column_break_izcc", - "quantity", + "category", "supervisor_warehouse", "finished", "section_break_1jdd", @@ -130,6 +130,7 @@ "label": "Design Description" }, { + "depends_on": "eval:doc.request_from == \"Jewellery Order\"", "fieldname": "category", "fieldtype": "Link", "label": "Category", @@ -251,7 +252,7 @@ "link_fieldname": "manufacturing_request" } ], - "modified": "2024-05-03 14:12:21.910906", + "modified": "2024-05-07 12:51:18.505865", "modified_by": "Administrator", "module": "AuMMS Manufacturing", "name": "Manufacturing Request", diff --git a/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.py b/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.py index a23a7d87..0ee14108 100644 --- a/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.py +++ b/aumms/aumms_manufacturing/doctype/manufacturing_request/manufacturing_request.py @@ -9,7 +9,10 @@ class ManufacturingRequest(Document): def autoname(self): - self.title = f"{self.purity} {self.expected_weight} {self.uom} {self.type} {self.category}" + if self.request_from == "Jewellery Order": + self.title = f"{self.purity} {self.expected_weight} {self.uom} {self.type} {self.category}" + elif self.request_from == "Raw Material Request" : + self.title = f"{self.purity} {self.expected_weight} {self.uom} {self.type}" def before_insert(self): self.update_manufacturing_stages() diff --git a/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.json b/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.json index 77a891eb..8857862e 100644 --- a/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.json +++ b/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.json @@ -13,7 +13,16 @@ "raw_material_available", "raw_materials_section", "items", - "amended_from" + "amended_from", + "section_break_ulxh", + "required_date", + "purity", + "quantity", + "supervisor_warehouse", + "column_break_bjkf", + "type", + "uom", + "category" ], "fields": [ { @@ -69,12 +78,74 @@ "fieldtype": "Check", "label": "Raw Material Available", "read_only": 1 + }, + { + "fetch_from": "manufacturing_request.required_date", + "fieldname": "required_date", + "fieldtype": "Date", + "hidden": 1, + "label": "Required Date" + }, + { + "fieldname": "section_break_ulxh", + "fieldtype": "Section Break", + "hidden": 1 + }, + { + "fetch_from": "manufacturing_request.type", + "fieldname": "type", + "fieldtype": "Link", + "hidden": 1, + "label": "Type", + "options": "Item Type" + }, + { + "fetch_from": "manufacturing_request.uom", + "fieldname": "uom", + "fieldtype": "Link", + "hidden": 1, + "label": "UOM", + "options": "UOM" + }, + { + "fetch_from": "manufacturing_request.quantity", + "fieldname": "quantity", + "fieldtype": "Int", + "hidden": 1, + "label": "Quantity" + }, + { + "fieldname": "column_break_bjkf", + "fieldtype": "Column Break" + }, + { + "fetch_from": "manufacturing_request.category", + "fieldname": "category", + "fieldtype": "Link", + "hidden": 1, + "label": "Category", + "options": "Item Category" + }, + { + "fetch_from": "manufacturing_request.purity", + "fieldname": "purity", + "fieldtype": "Link", + "hidden": 1, + "label": "Purity", + "options": "Purity" + }, + { + "fetch_from": "manufacturing_request.supervisor_warehouse", + "fieldname": "supervisor_warehouse", + "fieldtype": "Link", + "label": "Supervisor Warehouse", + "options": "Warehouse" } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-05-06 12:13:01.179566", + "modified": "2024-05-07 13:05:32.182882", "modified_by": "Administrator", "module": "AuMMS Manufacturing", "name": "Raw Material Bundle", diff --git a/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.py b/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.py index e87fe3d1..3dc36b94 100644 --- a/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.py +++ b/aumms/aumms_manufacturing/doctype/raw_material_bundle/raw_material_bundle.py @@ -52,6 +52,11 @@ def create_raw_material_request(docname): new_raw_material_request.raw_material_bundle = raw_material_bundle.name new_raw_material_request.manufacturing_request = raw_material_bundle.manufacturing_request new_raw_material_request.required_quantity = raw_material.required_quantity - raw_material.available_quantity + new_raw_material_request.required_date = raw_material_bundle.required_date + new_raw_material_request.uom = raw_material_bundle.uom + new_raw_material_request.item_type = raw_material_bundle.type + new_raw_material_request.purity = raw_material_bundle.purity + new_raw_material_request.supervisor_warehouse = raw_material_bundle.supervisor_warehouse new_raw_material_request.bundle_id = raw_material.raw_material_id new_raw_material_request.uom = uom new_raw_material_request.append('raw_material_details', { diff --git a/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.json b/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.json index 658920ef..2821cd07 100644 --- a/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.json +++ b/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.json @@ -15,6 +15,11 @@ "bundle_id", "uom", "required_quantity", + "supervisor_warehouse", + "section_break_9utr", + "required_date", + "item_type", + "purity", "column_break_dw7z", "not_available", "priority", @@ -123,12 +128,39 @@ { "fieldname": "column_break_dw7z", "fieldtype": "Column Break" + }, + { + "fieldname": "required_date", + "fieldtype": "Date", + "label": "Required Date" + }, + { + "fieldname": "section_break_9utr", + "fieldtype": "Column Break" + }, + { + "fieldname": "item_type", + "fieldtype": "Link", + "label": "Item Type", + "options": "Item Type" + }, + { + "fieldname": "purity", + "fieldtype": "Link", + "label": "Purity", + "options": "Purity" + }, + { + "fieldname": "supervisor_warehouse", + "fieldtype": "Link", + "label": "Supervisor Warehouse", + "options": "Warehouse" } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-05-06 14:32:14.681672", + "modified": "2024-05-07 13:06:36.599486", "modified_by": "Administrator", "module": "AuMMS Manufacturing", "name": "Raw Material Request", diff --git a/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.py b/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.py index 9e5ee025..670cde41 100644 --- a/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.py +++ b/aumms/aumms_manufacturing/doctype/raw_material_request/raw_material_request.py @@ -11,21 +11,22 @@ class RawMaterialRequest(Document): @frappe.whitelist() def create_manufacturing_request(self): manufacturing_request_exists = frappe.db.exists('Manufacturing Request', {'raw_material_request': self.name}) - if not manufacturing_request_exists: - manufacturing_request = frappe.new_doc('Manufacturing Request') - manufacturing_request.request_from = 'Raw Material Request' - manufacturing_request.raw_material_request = self.name - manufacturing_request.jewellery_order = self.jewellery_order - # manufacturing_request.required_date = self.required_date - manufacturing_request.quantity = self.required_quantity - # manufacturing_request.total_weight = self.weight - # manufacturing_request.item_name = self.item_name - manufacturing_request.uom = self.uom - # manufacturing_request.type = self.item_type - manufacturing_request.insert(ignore_permissions=True) - frappe.msgprint(f"Manufacturing Request {manufacturing_request.name} created.", indicator="green", alert=1) - else: - frappe.throw(_('Manufacturing Request already exist for this {0}'.format(self.name))) + for item in self.raw_material_details: + if not manufacturing_request_exists: + manufacturing_request = frappe.new_doc('Manufacturing Request') + manufacturing_request.request_from = 'Raw Material Request' + manufacturing_request.raw_material_request = self.name + manufacturing_request.jewellery_order = self.jewellery_order + manufacturing_request.required_date = self.required_date + manufacturing_request.quantity = self.required_quantity + manufacturing_request.expected_weight = item.required_quantity + manufacturing_request.purity = self.purity + manufacturing_request.uom = self.uom + manufacturing_request.type = self.item_type + manufacturing_request.insert(ignore_permissions=True) + frappe.msgprint(f"Manufacturing Request {manufacturing_request.name} created.", indicator="green", alert=1) + else: + frappe.throw(_('Manufacturing Request already exist for this {0}'.format(self.name))) @frappe.whitelist() def create_purchase_order(self):