Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
4385 Näkymät

Hi,

I have a custom application in that in some cases I require the fields to be readonly depending on who is logged in. I have created a function field so see if the user is admin or manager.

'am_i_the_manager': fields.function(_am_i_the_manager, string='Am I The Manager?', arg="manager", type='boolean'),


<button name="button_approve" colspan="1" string="Accept" type="object" icon="gtk-apply" attrs="{'invisible':[('state','!=','approval')], 'readonly':['|', ('am_i_the_manager','=',False),('state','!=','approval')]}" help="Accept and approve"/>

However when the form is in readonly mode the button is still active. If the filed is any other type it is behaving as readonly. Are buttons supposed to do this?

Avatar
Hylkää

Did you try first with Readonly (Check the case). And try to integrate the conditions in the attrs field

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
maalisk. 15
7266
1
syysk. 23
1922
2
toukok. 23
5997
3
jouluk. 21
15867
1
marrask. 19
3811