Tags


.py file

class notebook(osv.osv):
_name = "notebook"
_columns = {
    'title' : fields.char('Title', size=30, required=True),
    'tag_ids': fields.many2many(
                'hello',
                'notebook_hello_rel',
                'notebook_id',
                'hello_id',
                string="Tags"
                            ),
}

class hello(osv.osv):
_name = 'hello'
_columns = {
        'name':fields.char('Name',size=30),
        'note_ids': fields.many2many(
                            'notebook',
                            'notebook_hello_rel',
                            'hello_id',
                            'notebook_id',
                            string="Notebooks"
                                    ),
                } 

.xml file

many2many widget (default)
<field name="tag_ids" options="{'no_create': True}"/>

many2many_tags widget
<field name="tag_ids" widget="many2many_tags" options="{'no_create_edit': True}"/>

many2many_checkboxes widget
<field name="tag_ids" widget="many2many_checkboxes"/>

many2many_kanban widget

<field name="tag_ids" widget="many2many_kanban">
    <kanban>
        <field name="name"/>
        <templates>
            <t t-name="kanban-box">
                <field name="name"/>
            </t>
        </templates>
    </kanban>
</field>

x2many_counter widget
<field name="tag_ids" widget="x2many_counter" string="things"/>

many2many_binary widget
<field name="tag_ids" widget="many2many_binary" string="Attach a file"/>

Advertisements