[IMP] payroll: new structure should get as default for parent_id: ref(structure_base)

bzr revid: mra@mra-laptop-20110411103527-7zza1n093a27ohhu
This commit is contained in:
Mustufa Rangwala 2011-04-11 16:05:27 +05:30
parent a1fec3b62f
commit dd68253b95
1 changed files with 7 additions and 0 deletions

View File

@ -51,10 +51,17 @@ class hr_payroll_structure(osv.osv):
'note': fields.text('Description'),
'parent_id':fields.many2one('hr.payroll.structure', 'Parent'),
}
def _get_parent(self, cr, uid, context=None):
data_id = self.pool.get('ir.model.data').search(cr, uid, [('model', '=', 'hr.payroll.structure'), ('name', '=', 'structure_base')])
res = self.pool.get('ir.model.data').browse(cr, uid, data_id[0], context=context).res_id
return res or False
_defaults = {
'company_id': lambda self, cr, uid, context: \
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
'parent_id': _get_parent,
}
def copy(self, cr, uid, id, default=None, context=None):