Skip to Content
Menú
This question has been flagged
1 Respondre
4872 Vistes

Hi,

Odoo partner form view has following address types;

Contact, Invoice, Delivery, Private and Other.

I want to create a custom form view. I want to use this type field widget radio.

How can i set default selected value Contact?

For example;



But it is not working.

P.S: I'm using Odoo V16 Community Edition.

Thanks

Avatar
Descartar
Autor

For example;
<field name="type" required="1" widget="radio" default="contact"/>
But it is not working.

In the form view, you can use a radio box and set the default value for the address type field to "Contact" to set a default value.

Best Answer

Hi,

You can change your code like this,

Python :

radio = fields.Selection(
[('contact', 'Contact'), ('invoice', 'Invoice'), ('delivery', 'Delivery'),
('other', 'Other')], default='contact', tracking=True)

XML

<field name="radio" widget="radio"/>


Regards

Avatar
Descartar
Related Posts Respostes Vistes Activitat
4
de des. 23
22289
5
de jul. 24
15657
1
de juny 22
27172
9
de maig 22
53428
0
de jul. 20
2979