Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3647 Prikazi

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

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
jun. 19
7032
1
maj 19
7431
2
maj 25
797
2
avg. 22
5178
2
jul. 22
6933