Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3800 Переглядів

Hi, 

I would like to know how can I achieve this

I have a field called demofield that has the value 10 for example

And I would like that my field demofield2 has as default the value of the first demofield but it can be editable.

I have tried with  @api.onchange but always set the value of demofield2 as demofield and I can't change it.

Thank you for your help

Аватар
Відмінити
Найкраща відповідь

You have to set your demofield2 as a computed field;

demofield2 = fields.Float(compute='_compute_demofield2', store=True)
@api.depends('demofield')
def _compute_demofield2(self):
    self.demofield2 = self.demofield

The store=True parameter is very important to make the field editable.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
трав. 22
3879
1
груд. 21
6308
0
жовт. 21
2872
1
жовт. 21
3643
0
квіт. 21
1990