[MOD] hr : displays the category name with its parents
bzr revid: vir@tinyerp.com-20101005043841-8cnkrnfzv64pugq8
This commit is contained in:
@@ -26,10 +26,28 @@ import tools
|
||||
from tools.translate import _
|
||||
|
||||
class hr_employee_category(osv.osv):
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context)
|
||||
res = []
|
||||
for record in reads:
|
||||
name = record['name']
|
||||
if record['parent_id']:
|
||||
name = record['parent_id'][1]+' / '+name
|
||||
res.append((record['id'], name))
|
||||
return res
|
||||
|
||||
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context):
|
||||
res = self.name_get(cr, uid, ids, context)
|
||||
return dict(res)
|
||||
|
||||
_name = "hr.employee.category"
|
||||
_description = "Employee Category"
|
||||
_columns = {
|
||||
'name': fields.char("Category", size=64, required=True),
|
||||
'complete_name': fields.function(_name_get_fnc, method=True, type="char", string='Name'),
|
||||
'parent_id': fields.many2one('hr.employee.category', 'Parent Category', select=True),
|
||||
'child_ids': fields.one2many('hr.employee.category', 'parent_id', 'Child Categories')
|
||||
}
|
||||
|
||||
@@ -259,8 +259,7 @@
|
||||
<field eval="8" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Employees Categories">
|
||||
<field name="name"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="complete_name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user