Community mailing list archives

community@mail.odoo.com

Re: Search record using its field

by
Andre Kurniawan
- 06/09/2016 23:58:52
Hello Kitti,

I have seen the source code of the `filtered` method, its only a shortcut of what I did before using loop and if. What if I have thousands of records and I want to search for a couple record based on that query, won't it be so slow to search?

On 06/10/2016 10:47 AM, Kitti Upariphutthiphong wrote:
Hi,

Given you have records. In coding you can use

records.filtered(lambda r: r.qty < r.qty2)


On Fri, Jun 10, 2016 at 9:26 AM, vak0160 <vak0160.work@gmail.com> wrote:

Hello Community,

I Have a model with qty and qty2 fields, and I want to search for a record with qty < qty2 condition.
How I can do that without having to iterate all the record and search for the record sequentially using if?

-- 
Regards,
Andre

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


-- 
Regards,
Andre