Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6042 Zobrazení

Hi there,

I have two fields on the same form. "Field_1" and "Field_2".

When field_1 is changed, I need to copy it's content to field_2 on the same form.

How can I achieve that?

Regards

Paulo

 

Avatar
Zrušit
Nejlepší odpověď

Hi,

You can write an onchange function for the filed_1 and update the second field or make the field_2 as the related field of field_1.


@api.onchange('field_1')
def set_field2(self):
self.field_2 = self.field_1


Or

Make the field_2 as related field.

field_2 = fields.Char(string='Test', related='field_1')

Thanks

Avatar
Zrušit
Autor

Thank you @Niyas

Related Posts Odpovědi Zobrazení Aktivita
1
dub 25
2544
0
bře 24
684
1
říj 23
1045
2
říj 23
1401
2
srp 23
3111