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,14 +3,17 @@
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."))
frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted/renamed."))