Odoo Help

0

Get id of a record with the lowest sequence

By
josemi
on 4/28/16, 4:22 AM 441 views

I have this class

name = fields.Char("Name")

sequence = fields.Integer("Sequence")

description = fields.Text("Description")

I need a search method to find the id with lower sequence

1
Axel Mendoza
On 4/28/16, 8:33 AM

Hi Josemi

you could do it like:

lowest_id = self.env['model_name'].search([('sequence', '!=', False)], order='ASC', limit=1)

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.

Register

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)

Stats

Asked: 4/28/16, 4:22 AM
Seen: 441 times
Last updated: 4/28/16, 11:02 AM