I want set a permission for a button in a form of a module. this button defined in xml file of module view with this code:
<button name="tender_validate_special_access" groups="internal_services.group_internal_services_special_access_validator" states="manager_approve" string="Validate Special Access" type="object" icon="gtk-jump-to" />
---------------------------------------------------------------------------
but I want say when form state is != darft and department_second_id.manager_id.user_id = user.id , this button for example show "readonly" or "invisible" format.
I type a attr for button in this case:
attrs="{'readonly': ['&',('state','!=','draft'),('department_second_id.manager_id.user_id','!=',user.id)]}"
--------------------------------------------------------
( department_second_idis a many2one field in this module from hr module and use in this form. user.id is current user(login user))
but does not work!
I dont know what is problem?
-------------------------------------------------------
if I type this code:
attrs="{'readonly': [('state','!=',' draft ')]}"
it is work well.