跳至内容
菜单
此问题已终结
1 回复
4925 查看

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

形象
丢弃
编写者

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.

最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
4
12月 23
22335
5
7月 24
15696
1
6月 22
27218
9
5月 22
53473
0
7月 20
3014