Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3608 Widoki

Hi there.
I have the following compute function
What I'm trying is to keep the value for "name" filed in when the value new_name is deleted.
Right now when I'm deleting the value from the "new_name", the "name" fields is getting empty too.


@api.depends('new_name')
def _compute_new_name(self):
for rec in self:
if rec.new_name:
\rec\.name\\\ \=\ rec\.new_name\\
\else\:\ \\
\\ \\rec\.name\\\ \=\ \\rec.name

name = field.Chars(compute='_new_name', readonly=False, required=true)

new_name = inherited field
name = original name field for the record

google it after a solution but it didn't worked anything I tried, like:

rec.name = self._fields['name'].value(self)

thank you all

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
cze 19
7002
1
maj 19
7383
2
maj 25
761
2
sie 22
5126
2
lip 22
6894