sortinglistviewodooodoo-viewone2many

How to change the order of a One2many field?


I have a tree view, where the new items are placed above of all. Instead of that, I need to place the new item at the end of other items. Moreover, if the order of the new items is wrong I need to set them in the correct order

Where is this order configured? I need to change it

Update

The "editable" property has two options are: top and bottom. I did not know the top choice then I thought I had configured editable="bottom" which was not correct. I just switched to bottom and it worked properly


Solution

  • If you want to change the order of a tree or list you have mainly two options:

    You can order the table using the attribute _order in your model. Link

    _order = "name, date_order desc"
    

    If you are using Odoo v8-v15 you can add an attribute default_order in a specific tree view. Link

    <tree default_order="sequence,name desc">
    

    Is that what you're looking for?