Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4470 Visualizzazioni


@onchange has self._origin to get previous values, but this is not available for @constrains.

How do you get the previous value of a field? This is most usefull sometimes when you want to add a constrain based on a previous value


Right now I'm solving this in the write() method by getting the value before and after calling super.write and then raising an UserError. Seems this would be better fit for constrains


Thanks



Avatar
Abbandona
Risposta migliore

I go further and asks how to know if it is a newly created record from inside constrains decorator method?

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
dic 23
3324
0
giu 21
2660
2
giu 20
3213
2
mar 24
5677
1
lug 23
1694