Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3801 Vizualizări

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iun. 19
7149
1
mai 19
7556
2
mai 25
934
2
aug. 22
5365
2
iul. 22
7093