Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4555 Tampilan


@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
Buang
Jawaban Terbai

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

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
@api.constrains Diselesaikan
2
Des 23
3496
0
Jun 21
2780
2
Jun 20
3322
2
Mar 24
5821
1
Jul 23
1777