Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4892 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 12 23
22319
5
thg 7 24
15678
1
thg 6 22
27202
9
thg 5 22
53455
0
thg 7 20
2996