Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Ordering Line Items

Gavin Yap
on 3/31/16, 11:14 PM 163 views


I would have 2 models of the following

class Table(modes.Models):
    _name = 'mymodule.table'
    name = name = fields.Char(
        string='Table Name',
        help='Table Name',
    table_lines = field.One2many(

class TableLine(models.Model):
    _name = 'mymodule.table.line'
    name = fields.Char(
        help='Line Name',
    data = fields.Char(
table_id = fields.Many2one(

How could I create a form which has a tree/list view of my TableLine items and able to set them in order?


Gavin Yap
On 4/1/16, 5:30 AM

I just found out that, I need to add an attribute my TableLine model.

sequence = fields.Integer(
help='Set the order by sequence'

 and then in the tree view of this model

<!-- Tree view for TableLine settings -->
<record id="table_line_tree" model="ir.ui.view">
<field name="name">Table Lines</field>
<field name="model">mymodule.table.line</field>
<field name="arch" type="xml">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="data"/>

This should do the trick.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/31/16, 11:14 PM
Seen: 163 times
Last updated: 4/1/16, 5:30 AM