[IMP]: hr: Added on change department in employee form to set manager

bzr revid: rpa@tinyerp.com-20110311105449-0h02fpefhrk6kqhu
This commit is contained in:
Rucha (Open ERP)
2011-03-11 16:24:49 +05:30
parent e11dc0b43c
commit 9bc35e9192
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -178,6 +178,13 @@ class hr_employee(osv.osv):
address_id = address and address['default'] or False
return {'value': {'address_id' : address_id}}
def onchange_department_id(self, cr, uid, ids, department_id, context=None):
value = {'parent_id': False}
if department_id:
department = self.pool.get('hr.department').browse(cr, uid, department_id)
value['parent_id'] = department.manager_id.id
return {'value': value}
def onchange_user(self, cr, uid, ids, user_id, context=None):
work_email = False
if user_id:
+1 -1
View File
@@ -28,7 +28,7 @@
<field name="company_id" widget="selection" groups="base.group_multi_company,base.group_extended" on_change="onchange_company(company_id)"/>
<field name="active" groups="base.group_extended"/>
<newline/>
<field name="department_id" widget="selection" />
<field name="department_id" widget="selection" on_change="onchange_department_id(department_id)" />
<field name="parent_id" />
</group>
<group colspan="2" col="1">