Validate renaming of activity type - manufacturing

This commit is contained in:
Neil Trini Lasrado 2015-02-18 13:00:56 +05:30
parent 9f138b21fa
commit b091707ae8

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
class ActivityType(Document): class ActivityType(Document):
@ -11,6 +11,9 @@ class ActivityType(Document):
def on_trash(self): def on_trash(self):
self.validate_manufacturing_type() self.validate_manufacturing_type()
def before_rename(self, olddn, newdn, merge=False):
self.validate_manufacturing_type()
def validate_manufacturing_type(self): def validate_manufacturing_type(self):
if self.activity_type == 'Manufacturing': if self.activity_type == 'Manufacturing':
frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted.")) frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted/renamed."))