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

Hi,

I would like to apply a constraint on specific fields whatever the fileds that are modified.
For example I would like to check that field 'my_field' is checked whatever the filed that is changed :

@api.one
@api.constrains('write_date', 'create_date', 'my_field')
def my_constraints(self):
.../... Blabla raise ValdiationError

This part works well if my_field is modified, yet it's not thrown if another field is changed.
So the constraints does not apply each time you validate a record.
How is it possible to do so?

Do I need to override the write method?

regards

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
heinäk. 17
3955
1
elok. 25
956
1
elok. 25
1185
2
heinäk. 25
3879
3
heinäk. 25
1252