Search code examples
odoo-9

How can i display the delivery orders automatically in a way that the most recent is the first?


I'm using odoo 9 and i want to display delivery orders in a way that the last one (the most recent) is the first to display automatically . I tried to apply a filter to do this order but there is no solution. The only solution that i found is to press on the field date to make it in order that the last delivery created is shows the first. Is there a solution to do that automatically espacially that the sale orders display in thist way? Any idea for help please ?


Solution

  • Just inherit the stock.picking object and add the "_order" attribute(order by create_date descending)

    _order = "create_date desc, priority desc, date asc, id desc"
    

    This will show the recent created Delivery orders first

    class Picking(models.Model):
        _inherit = "stock.picking"
        _description = "Transfer"
        _order = "create_date desc, priority desc, date asc, id desc"