mira
mira

Reputation: 45

Odoo fixed checkbox

i'm creating fixed value to be view in my checkbox First i create new model containing those value

request = fields.Selection(
    [('t1', 'Test1'),
     ('t2', 'Test2'),
     ('t3', 'Test3'),
     ('t4', 'Test4'),
     ('t5', 'Test5'),
    string='Request')

Then i added Many2many field python file :

req = fields.Many2many('test.request', string="Request")

xml file:

<field name="req" widget="many2many_tags">

but still didn't show in my view i need it to be view as checkbox containing Test1,2,...etc

Upvotes: 2

Views: 1082

Answers (1)

Himanshu Sharma
Himanshu Sharma

Reputation: 716

You've to create records in new model with the required data. For example: Record1: Test1 , Record2: Test2 and so on and then use many2many field.

req = fields.Many2many('test.request', string="Request")

and for checkbox you can use widget: many2many_checkboxes widget

<field name="req" widget="many2many_checkboxes">

for selection field:

request = fields.Selection(
    [('t1', 'Test1'),
     ('t2', 'Test2'),
     ('t3', 'Test3'),
     ('t4', 'Test4'),
     ('t5', 'Test5'),
    string='Request')

xml:

<field name="request">

Upvotes: 1

Related Questions