diff --git a/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.js b/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.js index b8eaee9f..354eb4ca 100644 --- a/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.js +++ b/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.js @@ -5,6 +5,9 @@ frappe.ui.form.on("Jewellery Job Card", { refresh: function(frm){ create_custom_buttons(frm); calculate_total_weight(frm); + if (frm.doc.docstatus === 1) { + frm.remove_custom_button('Start'); + } } }); @@ -44,6 +47,7 @@ let create_custom_buttons = function(frm){ } } + function updateStartTime(frm) { const currentTime = frappe.datetime.now_datetime(); let row = frappe.model.add_child(frm.doc, 'Job Time', 'job_time'); diff --git a/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.py b/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.py index 3173ea6b..595961d5 100644 --- a/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.py +++ b/aumms/aumms_manufacturing/doctype/jewellery_job_card/jewellery_job_card.py @@ -48,8 +48,8 @@ def update_product(self): for stage in manufacturing_request.manufacturing_stages: if stage.manufacturing_stage == self.stage: for item in self.item_details: - frappe.db.set_value('Manufacturing Stage', stage.name, 'product', item.item) - frappe.db.set_value('Manufacturing Stage', stage.name, 'weight', item.weight) + frappe.db.set_value('Manufacturing Stage', stage.name, 'product', self.final_product) + frappe.db.set_value('Manufacturing Stage', stage.name, 'weight', self.weight) break def create_metal_ledger(self) : diff --git a/aumms/aumms_manufacturing/doctype/manufacturing__stage/manufacturing__stage.json b/aumms/aumms_manufacturing/doctype/manufacturing__stage/manufacturing__stage.json index ad842952..ca00ffbc 100644 --- a/aumms/aumms_manufacturing/doctype/manufacturing__stage/manufacturing__stage.json +++ b/aumms/aumms_manufacturing/doctype/manufacturing__stage/manufacturing__stage.json @@ -79,7 +79,7 @@ "read_only": 1 }, { - "depends_on": "eval:(doc.raw_material_available == 1 && doc.previous_stage_completed == 1)", + "depends_on": "eval:(doc.raw_material_available == 1 || (doc.previous_stage_completed == 1 && doc.is_raw_material_from_previous_stage_only == 1))", "fieldname": "create_job_card", "fieldtype": "Button", "label": "Create Job Card" @@ -89,6 +89,7 @@ "fieldtype": "Link", "in_list_view": 1, "label": "Smith", + "mandatory_depends_on": "eval:doc.raw_material_available == 1", "options": "Employee" }, { @@ -149,23 +150,30 @@ "options": "Warehouse" }, { + "depends_on": "eval:doc.completed == 1", "fieldname": "product", "fieldtype": "Link", "label": "Product", - "options": "Item" + "options": "Item", + "read_only": 1 }, { + "depends_on": "eval:doc.completed == 1", "fieldname": "weight", "fieldtype": "Float", - "label": "Weight" + "label": "Weight", + "read_only": 1 }, { + "depends_on": "eval:doc.previous_stage_completed == 1", "fieldname": "previous_stage_product", "fieldtype": "Link", "label": "Previous Stage Product", - "options": "Item" + "options": "Item", + "read_only": 1 }, { + "depends_on": "eval:doc.previous_stage_completed == 1", "fieldname": "previous_stage_weight", "fieldtype": "Float", "label": "Previous Stage Weight", @@ -185,4 +193,4 @@ "sort_field": "modified", "sort_order": "DESC", "states": [] -} \ No newline at end of file +}