read order by create_date

18 views
Skip to first unread message

Vincent Bastos

unread,
Nov 24, 2016, 1:16:58 AM11/24/16
to tryton-dev
Is there any reason why ordering by create_date wouldn't work?

Can't I use the following domain - 'create_date', 'DESC'?

Thanks

Sergi Almacellas Abellana

unread,
Nov 24, 2016, 3:35:44 AM11/24/16
to tryto...@googlegroups.com
Hi,

El 24/11/16 a les 07:16, Vincent Bastos ha escrit:
> Is there any reason why ordering by create_date wouldn't work?
>
I don't this so.
> Can't I use the following domain - 'create_date', 'DESC'?
Why not?

For me it's working:

>>> from proteus import Model, config
>>> config.set_trytond()
>>> View = Model.get('ir.ui.view')
>>> view, = View.find([], order=[('create_date', 'DESC')], limit=1)
>>> view.id
708
>>> view, = View.find([], limit=1)
>>> view.id
4



--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Cédric Krier

unread,
Nov 24, 2016, 3:45:03 AM11/24/16
to tryton-dev
On 2016-11-23 22:16, Vincent Bastos wrote:
> Is there any reason why ordering by create_date wouldn't work?
>
> Can't I use the following domain - 'create_date', 'DESC'?

You can but if you have an issue please provide the traceback.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Vincent Bastos

unread,
Nov 24, 2016, 4:25:51 AM11/24/16
to tryto...@googlegroups.com
Sorry for wasting both your times.

I didn't have an error, the ordering was just not working. In case you were wondering; I removed the following statements from the model and it has fixed my issue:

        cls._order.insert(0, ('create_date', 'DESC'))
        cls._order.insert(1, ('number', 'DESC'))
        cls._order.insert(2, ('id', 'DESC'))
 
--
Vincent Bastos
Lava Lab Software
Reply all
Reply to author
Forward
0 new messages