set department name with company abbr

This commit is contained in:
Zlash65 2018-05-11 12:36:54 +05:30
parent 39668609ce
commit 9a8f5bd6c7
2 changed files with 6 additions and 2 deletions

View File

@ -3,7 +3,7 @@
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:department_name",
"autoname": "",
"beta": 0,
"creation": "2013-02-05 11:48:26",
"custom": 0,
@ -434,7 +434,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-04-18 12:02:42.572599",
"modified": "2018-05-11 12:18:18.839182",
"modified_by": "Administrator",
"module": "HR",
"name": "Department",

View File

@ -10,6 +10,10 @@ from frappe.model.document import Document
class Department(NestedSet):
nsm_parent_field = 'parent_department'
def autoname(self):
abbr = frappe.db.get_value('Company', self.company, 'abbr')
self.name = '{0} - {1}'.format(self.department_name, abbr)
def update_nsm_model(self):
frappe.utils.nestedset.update_nsm(self)