From 6f272f2f533234c72a908f2d3642e89f3201e9ed Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 10 Mar 2015 17:30:39 +0530 Subject: [PATCH] fixes in Production Order --- .../production_order/production_order.js | 8 +- .../production_order/production_order.json | 13 +- .../production_order/production_order.py | 3 +- erpnext/patches.txt | 2 +- .../update_material_transferred_for_qty.py | 2 +- .../projects/doctype/time_log/time_log.json | 440 +++++++++--------- .../stock/doctype/stock_entry/stock_entry.py | 2 +- 7 files changed, 238 insertions(+), 232 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index a8911c9a87..3f99beef9a 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -59,12 +59,12 @@ erpnext.production_order = { var doc = frm.doc; if (doc.docstatus === 1) { - if (flt(doc.material_transferred_for_qty) < flt(doc.qty)) { + if (flt(doc.material_transferred_for_manufacturing) < flt(doc.qty)) { frm.add_custom_button(__('Transfer Materials for Manufacture'), cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]); } - if (flt(doc.produced_qty) < flt(doc.material_transferred_for_qty)) { + if (flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing)) { frm.add_custom_button(__('Update Finished Goods'), cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]); } @@ -160,8 +160,8 @@ $.extend(cur_frm.cscript, { make_se: function(purpose) { var me = this; var max = (purpose === "Manufacture") ? - flt(this.frm.doc.material_transferred_for_qty) - flt(this.frm.doc.produced_qty) : - flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_qty); + flt(this.frm.doc.qty) - flt(this.frm.doc.produced_qty) : + flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_manufacturing); frappe.prompt({fieldtype:"Int", label: __("Qty for {0}", [purpose]), fieldname:"qty", description: __("Max: {0}", [max]) }, diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json index c2f53bae4a..59473ad1e9 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.json +++ b/erpnext/manufacturing/doctype/production_order/production_order.json @@ -94,10 +94,13 @@ "reqd": 1 }, { + "default": "0", + "depends_on": "eval:doc.docstatus==1", "description": "", - "fieldname": "material_transferred_for_qty", - "fieldtype": "Int", - "label": "Material Transferred for Qty", + "fieldname": "material_transferred_for_manufacturing", + "fieldtype": "Float", + "label": "Material Transferred for Manufacturing", + "no_copy": 1, "permlevel": 0, "precision": "", "read_only": 1 @@ -351,8 +354,8 @@ "icon": "icon-cogs", "idx": 1, "in_create": 0, - "is_submittable": 1, - "modified": "2015-03-09 15:28:12.535414", + "is_submittable": 1, + "modified": "2015-03-10 17:02:28.401930", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Order", diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index e4a7292015..d0ad06e43c 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -124,8 +124,9 @@ class ProductionOrder(Document): def update_production_order_qty(self): """Update **Manufactured Qty** and **Material Transferred for Qty** in Production Order based on Stock Entry""" + print "call" for purpose, fieldname in (("Manufacture", "produced_qty"), - ("Material Transfer for Manufacture", "material_transferred_for_qty")): + ("Material Transfer for Manufacture", "material_transferred_for_manufacturing")): qty = flt(frappe.db.sql("""select sum(fg_completed_qty) from `tabStock Entry` where production_order=%s and docstatus=1 and purpose=%s""", (self.name, purpose))[0][0]) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a016262119..de9f26b4ee 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -118,7 +118,7 @@ erpnext.patches.v5_0.rename_customer_issue erpnext.patches.v5_0.update_material_transfer_for_manufacture erpnext.patches.v5_0.manufacturing_activity_type erpnext.patches.v5_0.update_item_description_and_image -erpnext.patches.v5_0.update_material_transferred_for_qty +erpnext.patches.v5_0.update_material_transferred_for_manufacturing erpnext.patches.v5_0.stock_entry_update_value erpnext.patches.v5_0.convert_stock_reconciliation erpnext.patches.v5_0.update_projects diff --git a/erpnext/patches/v5_0/update_material_transferred_for_qty.py b/erpnext/patches/v5_0/update_material_transferred_for_qty.py index 45b4889956..f377e23232 100644 --- a/erpnext/patches/v5_0/update_material_transferred_for_qty.py +++ b/erpnext/patches/v5_0/update_material_transferred_for_qty.py @@ -2,7 +2,7 @@ import frappe def execute(): frappe.reload_doctype("Production Order") - frappe.db.sql("""update `tabProduction Order` set material_transferred_for_qty= + frappe.db.sql("""update `tabProduction Order` set material_transferred_for_manufacturing= (select sum(fg_completed_qty) from `tabStock Entry` where docstatus=1 and production_order=`tabProduction Order`.name diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json index 5ab2efa922..c661b8968e 100644 --- a/erpnext/projects/doctype/time_log/time_log.json +++ b/erpnext/projects/doctype/time_log/time_log.json @@ -1,283 +1,285 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-04-03 16:38:41", - "description": "Log of Activities performed by users against Tasks that can be used for tracking time, billing.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-04-03 16:38:41", + "description": "Log of Activities performed by users against Tasks that can be used for tracking time, billing.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "options": "TL-", - "permlevel": 0, - "read_only": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "options": "TL-", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "from_time", - "fieldtype": "Datetime", - "in_list_view": 0, - "label": "From Time", - "permlevel": 0, - "read_only": 0, + "fieldname": "from_time", + "fieldtype": "Datetime", + "in_list_view": 0, + "label": "From Time", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "to_time", - "fieldtype": "Datetime", - "in_list_view": 0, - "label": "To Time", - "permlevel": 0, - "read_only": 0, + "fieldname": "to_time", + "fieldtype": "Datetime", + "in_list_view": 0, + "label": "To Time", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "hours", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Hours", - "permlevel": 0, + "fieldname": "hours", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Hours", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "billable", - "fieldtype": "Check", - "in_list_view": 0, - "label": "Billable", - "permlevel": 0, + "fieldname": "billable", + "fieldtype": "Check", + "in_list_view": 0, + "label": "Billable", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "user", - "fieldtype": "Link", - "label": "User", - "options": "User", - "permlevel": 0, + "fieldname": "user", + "fieldtype": "Link", + "label": "User", + "options": "User", + "permlevel": 0, "precision": "" - }, + }, { - "fieldname": "column_break_3", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "status", - "fieldtype": "Select", - "in_list_view": 0, - "label": "Status", - "options": "Draft\nSubmitted\nBatched for Billing\nBilled\nCancelled", - "permlevel": 0, - "read_only": 1, + "fieldname": "status", + "fieldtype": "Select", + "in_list_view": 0, + "label": "Status", + "options": "Draft\nSubmitted\nBatched for Billing\nBilled\nCancelled", + "permlevel": 0, + "read_only": 1, "reqd": 0 - }, + }, { - "default": "Project", - "fieldname": "time_log_for", - "fieldtype": "Select", - "label": "Time Log For", - "options": "Project\nManufacturing", - "permlevel": 0, - "precision": "", - "read_only": 1, + "default": "Project", + "fieldname": "time_log_for", + "fieldtype": "Select", + "label": "Time Log For", + "options": "Project\nManufacturing", + "permlevel": 0, + "precision": "", + "read_only": 1, "reqd": 0 - }, + }, { - "depends_on": "", - "fieldname": "activity_type", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Activity Type", - "options": "Activity Type", - "permlevel": 0, - "read_only": 0, + "depends_on": "", + "fieldname": "activity_type", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Activity Type", + "options": "Activity Type", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:doc.time_log_for != 'Manufacturing'", - "fieldname": "task", - "fieldtype": "Link", - "label": "Task", - "options": "Task", - "permlevel": 0, + "depends_on": "eval:doc.time_log_for != 'Manufacturing'", + "fieldname": "task", + "fieldtype": "Link", + "label": "Task", + "options": "Task", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", - "fieldname": "section_break_11", - "fieldtype": "Section Break", - "permlevel": 0, + "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "fieldname": "section_break_11", + "fieldtype": "Section Break", + "permlevel": 0, "precision": "" - }, + }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", - "fieldname": "production_order", - "fieldtype": "Link", - "label": "Production Order", - "options": "Production Order", - "permlevel": 0, - "precision": "", + "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "fieldname": "production_order", + "fieldtype": "Link", + "label": "Production Order", + "options": "Production Order", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", - "fieldname": "operation", - "fieldtype": "Select", - "label": "Operation", - "options": "", - "permlevel": 0, - "precision": "", + "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "fieldname": "operation", + "fieldtype": "Select", + "label": "Operation", + "options": "", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "fieldname": "operation_id", - "fieldtype": "Data", - "label": "Operation ID", - "options": "", - "permlevel": 0, - "precision": "", + "fieldname": "operation_id", + "fieldtype": "Data", + "hidden": 1, + "label": "Operation ID", + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "column_break_14", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break_14", + "fieldtype": "Column Break", + "permlevel": 0, "precision": "" - }, + }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", - "fieldname": "workstation", - "fieldtype": "Link", - "label": "Workstation", - "options": "Workstation", - "permlevel": 0, - "precision": "", + "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "fieldname": "workstation", + "fieldtype": "Link", + "label": "Workstation", + "options": "Workstation", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", - "description": "Operation completed for how many finished goods?", - "fieldname": "completed_qty", - "fieldtype": "Float", - "label": "Completed Qty", - "permlevel": 0, + "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "description": "Operation completed for how many finished goods?", + "fieldname": "completed_qty", + "fieldtype": "Float", + "label": "Completed Qty", + "permlevel": 0, "precision": "" - }, + }, { - "fieldname": "section_break_7", - "fieldtype": "Section Break", - "permlevel": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "note", - "fieldtype": "Text Editor", - "label": "Note", - "permlevel": 0, + "fieldname": "note", + "fieldtype": "Text Editor", + "label": "Note", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "section_break_9", - "fieldtype": "Section Break", - "permlevel": 0, + "fieldname": "section_break_9", + "fieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.time_log_for", - "fieldname": "project", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Project", - "options": "Project", - "permlevel": 0, + "depends_on": "eval:doc.time_log_for", + "fieldname": "project", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Project", + "options": "Project", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "Will be updated when batched.", - "fieldname": "time_log_batch", - "fieldtype": "Link", - "label": "Time Log Batch", - "options": "Time Log Batch", - "permlevel": 0, + "description": "Will be updated when batched.", + "fieldname": "time_log_batch", + "fieldtype": "Link", + "label": "Time Log Batch", + "options": "Time Log Batch", + "permlevel": 0, "read_only": 1 - }, + }, { - "description": "Will be updated when billed.", - "fieldname": "sales_invoice", - "fieldtype": "Link", - "label": "Sales Invoice", - "options": "Sales Invoice", - "permlevel": 0, + "description": "Will be updated when billed.", + "fieldname": "sales_invoice", + "fieldtype": "Link", + "label": "Sales Invoice", + "options": "Sales Invoice", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "column_break_16", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break_16", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "options": "Time Log", - "permlevel": 1, - "print_hide": 1, + "fieldname": "amended_from", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "options": "Time Log", + "permlevel": 1, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "title", - "fieldtype": "Data", - "hidden": 1, - "label": "Title", - "permlevel": 0, + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "label": "Title", + "permlevel": 0, "precision": "" } - ], - "icon": "icon-time", - "idx": 1, - "is_submittable": 1, - "modified": "2015-02-26 02:22:10.312376", - "modified_by": "Administrator", - "module": "Projects", - "name": "Time Log", - "owner": "Administrator", + ], + "icon": "icon-time", + "idx": 1, + "is_submittable": 1, + "modified": "2015-03-10 17:07:35.506886", + "modified_by": "Administrator", + "module": "Projects", + "name": "Time Log", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Projects User", - "share": 1, - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Projects User", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Projects Manager", - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Projects Manager", + "share": 1, + "submit": 1, "write": 1 } - ], + ], "title_field": "title" -} +} \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 6c398f70d2..619d6c26a2 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -470,7 +470,7 @@ class StockEntry(StockController): pro_doc = frappe.get_doc("Production Order", self.production_order) _validate_production_order(pro_doc) pro_doc.run_method("update_status") - if self.purpose in "Manufacture": + if self.purpose in ["Material Transfer for Manufacture","Manufacture"]: pro_doc.run_method("update_production_order_qty") self.update_planned_qty(pro_doc)