Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5 Risposte
8786 Visualizzazioni

I am trying to define a new field in read only mode, but it is not working:

<field name="sale_margin_percent" groups="base.group_user" attr="{'readonly': True}"/>

what is wrong with above definition? thanks

Avatar
Abbandona
Risposta migliore

you can do readonly="1" without attr... attr is usefull if you want use a domain for conditional value...

Avatar
Abbandona
Autore

If I save the record, should readonly="1" fields be stored into database?

Risposta migliore

You can use functional field for this purpose.

Avatar
Abbandona
Autore Risposta migliore

Using readonly="1" makes the user not being able to edit the field, but it is neither moved to database when you store the record.

Aa the field is updatd by onchange events, I would like to be able to avoid user modifying that field but at the same time moving the value back to database on save.

Any ideas?

Avatar
Abbandona

You can create a second field. First fiels are updated by onchange and invisible in form. Second fields is a related in readonly. Should works...

Post correlati Risposte Visualizzazioni Attività
4
mag 23
10509
1
gen 19
9595
0
ott 17
3423
0
nov 16
2696
0
ott 16
4954