I need to domain treeview if current user is manager of the department.
In my model:
department_new = fields.Many2one('hr.department',
string='New department',
required=True)
manager_new = fields.Many2one('hr.employee', readonly=True)@api.multi
def action_send(self):
self.manager_new = self.department_new.manager_id
return self.write({ 'stage' : 'sent' })
and in my view:
<record model="ir.actions.act_window" id="action_my_income_transfers">
<field name="name">Transfer requests</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">employee.transfer</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain_force">[('stage', '=', 'confirmed_cur'),('manager_new.id','=',uid)]</field>
</record>
But ('manager_new.id','=',uid) always false
Filed manager_new is right if show it as field in form
Similar using uid in another act_window works right
<record model="ir.actions.act_window" id="action_my_transfers">
<field name="name">Transfer requests</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">employee.transfer</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id', '=', uid)]</field>
</record>
user_id = fields.Many2one('res.users', string='user id', default=lambda self: self.env.user.id)
How can i solve this problem?