Odoo Help


Ordering Line Items

Gavin Yap
on 3/31/16, 11:14 PM 292 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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


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