Merge pull request #2745 from neilLasrado/time-log
activity type fixes
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index f7e7849..85f5bda 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -111,3 +111,4 @@
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
diff --git a/erpnext/patches/v5_0/manufacturing_activity_type.py b/erpnext/patches/v5_0/manufacturing_activity_type.py
new file mode 100644
index 0000000..d4e7873
--- /dev/null
+++ b/erpnext/patches/v5_0/manufacturing_activity_type.py
@@ -0,0 +1,13 @@
+# Copyright (c) 2013, Web Notes 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') {
+ doc = frappe.new_doc('Activity Type')
+ doc.update({
+ 'activity_type' : 'Manufacturing'
+ })
+ doc.save()
+ }
\ No newline at end of file
diff --git a/erpnext/projects/doctype/activity_type/activity_type.py b/erpnext/projects/doctype/activity_type/activity_type.py
index a98d8cf..7e316b5 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.py
+++ b/erpnext/projects/doctype/activity_type/activity_type.py
@@ -7,4 +7,10 @@
from frappe.model.document import Document
class ActivityType(Document):
- pass
\ No newline at end of file
+
+ def on_trash(self):
+ self.validate_manufacturing_type()
+
+ def validate_manufacturing_type(self):
+ if self.activity_type == 'Manufacturing':
+ frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted."))
\ No newline at end of file
diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py
index 96ea0d9..b24eaa6 100644
--- a/erpnext/setup/page/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/page/setup_wizard/install_fixtures.py
@@ -135,7 +135,7 @@
{'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': 'Activity Type', 'activity_type': 'Manufacturing'},
# Industry Type
{'doctype': 'Industry Type', 'industry': _('Accounting')},