Reputation: 1137
How can I have order records to be able to work with it?
I tried
not_clean_data = self.env['my_model'].search([],order = 'user_id, datetime asc')
but in vain
Upvotes: 5
Views: 10620
Reputation: 340
Define in your py file
def _get_default_data(self):
not_clean_data = self.env['my_model'].search([], order='user_id desc, datetime asc, limit=1)
print "group:"
return not_clean_data
xyz = fields.Many2one('my_model', "ABC", change_default=True, default=_get_default_data)
I hope it helps you. Thanks
Upvotes: 0
Reputation: 723
You have to provide order rule for each field separately:
not_clean_data = self.env['my_model'].search([], order='user_id desc, datetime asc')
Upvotes: 12