[FIX]add a field to sort hr_employee by name

lp bug: https://launchpad.net/bugs/1077140 fixed

bzr revid: csn@openerp.com-20121113153645-0lywi300wseowczw
This commit is contained in:
Cedric Snauwaert
2012-11-13 16:36:45 +01:00
+4
View File
@@ -158,6 +158,8 @@ class hr_employee(osv.osv):
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
_columns = {
#we need a related field in order to be able to sort the employee by name
'name_related': fields.related('resource_id', 'name', type='char', string='Name', readonly=True, store=True),
'country_id': fields.many2one('res.country', 'Nationality'),
'birthday': fields.date("Date of Birth"),
'ssnid': fields.char('SSN No', size=32, help='Social Security Number'),
@@ -207,6 +209,8 @@ class hr_employee(osv.osv):
'last_login': fields.related('user_id', 'date', type='datetime', string='Latest Connection', readonly=1),
}
_order='name_related'
def create(self, cr, uid, data, context=None):
employee_id = super(hr_employee, self).create(cr, uid, data, context=context)
try: