[IMP] hr: automatic fields population
When creating new Employee and linking to the existed user, this fix will populate not only email address field, but also full name and avatar image. Closes #7397
This commit is contained in:
committed by
Nicolas Martinelli
parent
d2b4b3909e
commit
c643c8bb39
+7
-3
@@ -247,10 +247,14 @@ class hr_employee(osv.osv):
|
||||
return {'value': value}
|
||||
|
||||
def onchange_user(self, cr, uid, ids, user_id, context=None):
|
||||
work_email = False
|
||||
if user_id:
|
||||
work_email = self.pool.get('res.users').browse(cr, uid, user_id, context=context).email
|
||||
return {'value': {'work_email': work_email}}
|
||||
user = self.pool['res.users'].browse(cr, uid, user_id, context=context)
|
||||
values = {
|
||||
'name': user.name,
|
||||
'work_email': user.email,
|
||||
'image': user.image,
|
||||
}
|
||||
return {'value': values}
|
||||
|
||||
def action_follow(self, cr, uid, ids, context=None):
|
||||
""" Wrapper because message_subscribe_users take a user_ids=None
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<form string="Employee">
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box"/>
|
||||
<field name="image_medium" widget='image' class="oe_left oe_avatar"/>
|
||||
<field name="image" widget='image' class="oe_left oe_avatar" options='{"preview_image":"image_medium"}'/>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
<h1>
|
||||
|
||||
Reference in New Issue
Block a user