Hello
I would like to have a checkbox on my app employee, and I would like this check box is check or uncheck on depends on 2 other fields!
explication:
on my form i have two fields :
'user_id' (the user relative to the employee)
'x_user_id' (a personal field and it's the id of the connected user)
So if the connected user is the same of the employee in the view i want my checkbox is uncheck
else if the connected user is different of the employee in the view i want my checkbox is check.
I try to create à boolean field with a compute arg !!! but i don't know how to write this in the compute cells!
I try to create a simple module like this but it doesn't work !!!
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
class hremployee(models.Model):
_name = "hr.employee"
_description = "Employee"
_inherit = "hr.employee"
def _get_employee_user(self, cr, uid, ids, field_name, args, context=None):
if context is None:
context = {}
if isinstance(ids, (int, long)):
ids = [ids]
res = {}
for emp in self.browse(cr, uid, ids, context=context):
res[emp.id] = True
if emp.user_id == uid:
res[emp.id] = False
return res
invisible = fields.Boolean(compute='_get_employee_user')
Can you help me?