Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
3700 Weergaven

Hi guys I am having a problem with attrs tags not working.

I defined it this way:

pseudo code:

'readonly':[('many2one_field','=','function.field(type='integer')]'

real code:

<field name="product_id" attrs="{'readonly':[('warehouse_id','=','user_permission')]}"/>

Function field is right above this field so it is created and it returns {id:value}.

What am I doing wrong?

Avatar
Annuleer
Auteur Beste antwoord

Nope.

NameError: name 'user_permission' is not defined

Avatar
Annuleer

For you additional functional field should be a solution. see my answer.

Beste antwoord


you can take another approach,


add one more field in your model:

_columns = {
    'is_editable': fields.function(_is_editable, type='boolean', string="Can Be Edited"),
    ...
}


implement _is_editable -function in your model that will calculate is_editable field according your requirements. 

then in xml, use is_editable field as follows:

<field name="is_editable" invisible="1"/>
<field name="product_id" attrs="{'readonly':[('is_editable','=',False)]}"/>


cheers.


Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
feb. 25
8632
3
jan. 19
7214
2
jun. 15
8173
2
jul. 18
8166
2
feb. 18
3953