diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index bf4e90ff29..f5269982ae 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -373,7 +373,7 @@ def get_events(start, end, filters=None): @frappe.whitelist() def make_time_log(name, operation, from_time, to_time, qty=None, project=None, workstation=None, operation_id=None): time_log = frappe.new_doc("Time Log") - time_log.time_log_for = 'Manufacturing' + time_log.against_manufacturing = 1 time_log.from_time = from_time time_log.to_time = to_time time_log.production_order = name diff --git a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json index b1a633036b..faa7687f1d 100644 --- a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json +++ b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json @@ -18,7 +18,7 @@ { "allow_on_submit": 0, "fieldname": "operation", - "fieldtype": "Text", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, @@ -27,7 +27,7 @@ "no_copy": 0, "oldfieldname": "operation_no", "oldfieldtype": "Data", - "options": "", + "options": "Operation", "permlevel": 0, "precision": "", "print_hide": 0, @@ -292,7 +292,7 @@ "is_submittable": 0, "issingle": 0, "istable": 1, - "modified": "2015-02-24 00:27:44.651084", + "modified": "2015-03-24 07:02:54.203235", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Order Operation", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 8c4b7ab774..3c8ca5f446 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -116,7 +116,6 @@ erpnext.patches.v5_0.rename_total_fields erpnext.patches.v5_0.new_crm_module 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_manufacturing erpnext.patches.v5_0.stock_entry_update_value diff --git a/erpnext/patches/v5_0/manufacturing_activity_type.py b/erpnext/patches/v5_0/manufacturing_activity_type.py deleted file mode 100644 index f0768322e2..0000000000 --- a/erpnext/patches/v5_0/manufacturing_activity_type.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -import frappe - -def execute(): - if not frappe.db.exists('Activity Type','Manufacturing') and frappe.get_all("Company"): - frappe.get_doc({ - "doctype": "Activity Type", - "activity_type": "Manufacturing" - }).insert() diff --git a/erpnext/projects/doctype/activity_type/activity_type.py b/erpnext/projects/doctype/activity_type/activity_type.py index 29a834bebd..8b610c2956 100644 --- a/erpnext/projects/doctype/activity_type/activity_type.py +++ b/erpnext/projects/doctype/activity_type/activity_type.py @@ -2,18 +2,7 @@ # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals -import frappe -from frappe import _ from frappe.model.document import Document class ActivityType(Document): - - def on_trash(self): - self.validate_manufacturing_type() - - def before_rename(self, olddn, newdn, merge=False): - self.validate_manufacturing_type() - - def validate_manufacturing_type(self): - if self.activity_type == 'Manufacturing': - frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted/renamed.")) \ No newline at end of file + pass \ No newline at end of file diff --git a/erpnext/projects/doctype/time_log/test_records.json b/erpnext/projects/doctype/time_log/test_records.json index 077071ce08..d9e67e954a 100644 --- a/erpnext/projects/doctype/time_log/test_records.json +++ b/erpnext/projects/doctype/time_log/test_records.json @@ -6,7 +6,6 @@ "from_time": "2013-01-01 10:00:00.000000", "note": "_Test Note", "to_time": "2013-01-01 11:00:00.000000", - "time_log_for": "Project", "project": "_Test Project" } ] diff --git a/erpnext/projects/doctype/time_log/test_time_log.py b/erpnext/projects/doctype/time_log/test_time_log.py index 22c1ec03ce..c54755eed0 100644 --- a/erpnext/projects/doctype/time_log/test_time_log.py +++ b/erpnext/projects/doctype/time_log/test_time_log.py @@ -36,7 +36,7 @@ class TestTimeLog(unittest.TestCase): time_log = frappe.get_doc({ "doctype": "Time Log", - "time_log_for": "Manufacturing", + "against_manufacturing": 1, "production_order": prod_order.name, "qty": 1, "from_time": "2014-12-26 00:00:00", @@ -54,7 +54,7 @@ class TestTimeLog(unittest.TestCase): time_log = frappe.get_doc({ "doctype": "Time Log", - "time_log_for": "Manufacturing", + "against_manufacturing": 1, "production_order": prod_order.name, "operation": prod_order.operations[0].operation, "operation_id": prod_order.operations[0].name, diff --git a/erpnext/projects/doctype/time_log/time_log.js b/erpnext/projects/doctype/time_log/time_log.js index a97cd590ec..a7065cb72c 100644 --- a/erpnext/projects/doctype/time_log/time_log.js +++ b/erpnext/projects/doctype/time_log/time_log.js @@ -5,7 +5,7 @@ frappe.provide("erpnext.projects"); frappe.ui.form.on("Time Log", "onload", function(frm) { frm.set_query("task", erpnext.queries.task); - if (frm.doc.time_log_for == "Manufacturing") { + if (frm.doc.against_manufacturing) { frappe.ui.form.trigger("Time Log", "production_order"); } }); @@ -60,7 +60,7 @@ $.extend(cur_frm.cscript, { frappe.model.with_doc("Production Order", doc.production_order, function(pro) { doc = frappe.get_doc("Production Order",pro); $.each(doc.operations , function(i, row){ - operations[i] = (i+1) +". "+ row.operation; + operations[i] = row.operation; }); frappe.meta.get_docfield("Time Log", "operation", me.frm.doc.name).options = "\n" + operations.join("\n"); refresh_field("operation"); @@ -81,11 +81,5 @@ $.extend(cur_frm.cscript, { } } }); - }, - - time_log_for: function(doc) { - if (doc.time_log_for == 'Manufacturing') { - cur_frm.set_value("activity_type", "Manufacturing") - } } }); diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json index c661b8968e..571b74c109 100644 --- a/erpnext/projects/doctype/time_log/time_log.json +++ b/erpnext/projects/doctype/time_log/time_log.json @@ -42,14 +42,6 @@ "permlevel": 0, "read_only": 0 }, - { - "fieldname": "billable", - "fieldtype": "Check", - "in_list_view": 0, - "label": "Billable", - "permlevel": 0, - "read_only": 0 - }, { "fieldname": "user", "fieldtype": "Link", @@ -75,18 +67,23 @@ "reqd": 0 }, { - "default": "Project", - "fieldname": "time_log_for", - "fieldtype": "Select", - "label": "Time Log For", - "options": "Project\nManufacturing", + "fieldname": "billable", + "fieldtype": "Check", + "in_list_view": 0, + "label": "Billable", "permlevel": 0, - "precision": "", - "read_only": 1, - "reqd": 0 + "read_only": 0 }, { - "depends_on": "", + "fieldname": "against_manufacturing", + "fieldtype": "Check", + "label": "Against Manufacturing", + "permlevel": 0, + "precision": "", + "read_only": 1 + }, + { + "depends_on": "eval:!doc.against_manufacturing", "fieldname": "activity_type", "fieldtype": "Link", "in_list_view": 0, @@ -94,10 +91,10 @@ "options": "Activity Type", "permlevel": 0, "read_only": 0, - "reqd": 1 + "reqd": 0 }, { - "depends_on": "eval:doc.time_log_for != 'Manufacturing'", + "depends_on": "eval:!doc.against_manufacturing", "fieldname": "task", "fieldtype": "Link", "label": "Task", @@ -106,33 +103,34 @@ "read_only": 0 }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "depends_on": "eval:doc.against_manufacturing", "fieldname": "section_break_11", "fieldtype": "Section Break", "permlevel": 0, "precision": "" }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "depends_on": "", "fieldname": "production_order", "fieldtype": "Link", "label": "Production Order", "options": "Production Order", "permlevel": 0, "precision": "", - "read_only": 1 + "read_only": 0 }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "depends_on": "", "fieldname": "operation", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Operation", - "options": "", + "options": "Operation", "permlevel": 0, "precision": "", - "read_only": 1 + "read_only": 0 }, { + "depends_on": "", "fieldname": "operation_id", "fieldtype": "Data", "hidden": 1, @@ -150,17 +148,17 @@ "precision": "" }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "depends_on": "", "fieldname": "workstation", "fieldtype": "Link", "label": "Workstation", "options": "Workstation", "permlevel": 0, "precision": "", - "read_only": 1 + "read_only": 0 }, { - "depends_on": "eval:doc.time_log_for == 'Manufacturing'", + "depends_on": "", "description": "Operation completed for how many finished goods?", "fieldname": "completed_qty", "fieldtype": "Float", @@ -188,7 +186,7 @@ "read_only": 0 }, { - "depends_on": "eval:doc.time_log_for", + "depends_on": "", "fieldname": "project", "fieldtype": "Link", "in_list_view": 1, @@ -244,7 +242,7 @@ "icon": "icon-time", "idx": 1, "is_submittable": 1, - "modified": "2015-03-10 17:07:35.506886", + "modified": "2015-03-24 07:10:31.412669", "modified_by": "Administrator", "module": "Projects", "name": "Time Log", diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py index 98cfcc54a4..24eba1ceb6 100644 --- a/erpnext/projects/doctype/time_log/time_log.py +++ b/erpnext/projects/doctype/time_log/time_log.py @@ -23,7 +23,6 @@ class TimeLog(Document): self.validate_time_log_for() self.check_workstation_timings() self.validate_production_order() - self.validate_project() self.validate_manufacturing() def on_submit(self): @@ -104,7 +103,7 @@ class TimeLog(Document): self.hours = flt(time_diff_in_seconds(self.to_time, self.from_time)) / 3600 def validate_time_log_for(self): - if self.time_log_for == "Project": + if not self.against_manufacturing: for fld in ["production_order", "operation", "workstation", "completed_qty"]: self.set(fld, None) @@ -123,7 +122,7 @@ class TimeLog(Document): def update_production_order(self): """Updates `start_date`, `end_date`, `status` for operation in Production Order.""" - if self.time_log_for=="Manufacturing" and self.production_order: + if self.against_manufacturing and self.production_order: if not self.operation_id: frappe.throw(_("Operation ID not set")) @@ -185,15 +184,8 @@ class TimeLog(Document): where production_order = %s and operation_id = %s and docstatus=1""", (self.production_order, self.operation_id), as_dict=1)[0] - def validate_project(self): - if self.time_log_for == 'Project': - if not self.project: - frappe.throw(_("Project is Mandatory.")) - if self.time_log_for == "": - self.project = None - def validate_manufacturing(self): - if self.time_log_for == 'Manufacturing': + if self.against_manufacturing: if not self.production_order: frappe.throw(_("Production Order is Mandatory")) if not self.operation: diff --git a/erpnext/projects/doctype/time_log/time_log_list.js b/erpnext/projects/doctype/time_log/time_log_list.js index 073d2027e5..c6ab673486 100644 --- a/erpnext/projects/doctype/time_log/time_log_list.js +++ b/erpnext/projects/doctype/time_log/time_log_list.js @@ -3,7 +3,7 @@ // render frappe.listview_settings['Time Log'] = { - add_fields: ["status", "billable", "activity_type", "task", "project", "hours", "time_log_for"], + add_fields: ["status", "billable", "activity_type", "task", "project", "hours", "against_manufacturing"], selectable: true, onload: function(me) { me.page.add_menu_item(__("Make Time Log Batch"), function() { diff --git a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py index 51a3240f45..5e94a23976 100644 --- a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py +++ b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py @@ -35,7 +35,7 @@ def create_time_log(): "from_time": "2013-01-02 10:00:00.000000", "to_time": "2013-01-02 11:00:00.000000", "docstatus": 0, - "time_log_for": "Project" + "against_manufacturing": 0 }) time_log.insert() time_log.submit() diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py index 324fd1cce4..32fb6a53e8 100644 --- a/erpnext/setup/page/setup_wizard/install_fixtures.py +++ b/erpnext/setup/page/setup_wizard/install_fixtures.py @@ -135,7 +135,6 @@ def install(country=None): {'doctype': 'Activity Type', 'activity_type': _('Proposal Writing')}, {'doctype': 'Activity Type', 'activity_type': _('Execution')}, {'doctype': 'Activity Type', 'activity_type': _('Communication')}, - {'doctype': 'Activity Type', 'activity_type': 'Manufacturing'}, {'doctype': "Item Attribute", "attribute_name": _("Size"), "item_attribute_values": [ {"attribute_value": _("Extra Small"), "abbr": "XS"}, @@ -158,7 +157,7 @@ def install(country=None): {'doctype': "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"} ] - from erpnext.setup.page.setup_wizard.fixtures import industry_type, operations + from erpnext.setup.page.setup_wizard.fixtures import industry_type records += [{"doctype":"Industry Type", "industry": d} for d in industry_type.items] # records += [{"doctype":"Operation", "operation": d} for d in operations.items]