Skip to Content
Menu
This question has been flagged
1 Reply
2589 Views

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
Discard
Related Posts Replies Views Activity
1
Jun 19
6780
1
May 19
6470
2
Aug 22
3428
2
Jul 22
4899
1
Sep 21
11642