diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f7e7849627..85f5bdae93 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -111,3 +111,4 @@ erpnext.patches.v5_0.update_item_name_in_bom 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 0000000000..d4e78733ba --- /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 a98d8cf0ec..7e316b532d 100644 --- a/erpnext/projects/doctype/activity_type/activity_type.py +++ b/erpnext/projects/doctype/activity_type/activity_type.py @@ -7,4 +7,10 @@ import frappe 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 96ea0d93d9..b24eaa6cd7 100644 --- a/erpnext/setup/page/setup_wizard/install_fixtures.py +++ b/erpnext/setup/page/setup_wizard/install_fixtures.py @@ -135,7 +135,7 @@ 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': 'Activity Type', 'activity_type': 'Manufacturing'}, # Industry Type {'doctype': 'Industry Type', 'industry': _('Accounting')},