check docstatus before updating employee

This commit is contained in:
Pratik Vyas 2014-03-13 02:35:23 +05:30
parent 7c932003ed
commit 5c81f9c44e

View File

@ -39,7 +39,7 @@ class DocType(DocListController):
self.validate_duplicate_user_id()
def on_update(self):
if self.doc.user_id:
if self.doc.user_id and frappe.db.get_value("Profile", self.doc.user_id, 'docstatus') == 0:
self.restrict_user()
self.update_user_default()
self.update_user()
@ -212,4 +212,4 @@ def get_retirement_date(date_of_birth=None):
if date_of_birth:
dt = getdate(date_of_birth) + datetime.timedelta(21915)
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
return ret
return ret