Community mailing list archives

community@mail.odoo.com

Re: New api browse - what for if search returns record set?

by
Camptocamp SA, Yannick Vaucher
- 10/08/2014 05:03:45
@api.one is to create a function that will loop on each record of you record set. It only saves you the "for rec in self:"
Nevertheless self in @api.one decorated method will still be a recordset with a len of 1 so nothing prevent you from doing self.browse() in it.

You just have to remind that what you return in @api.one will be a list.

Cheers,

On Sat, Oct 4, 2014 at 12:28 PM, Maxim Litnitskiy <litnimaxster@gmail.com> wrote:

2014-10-03 15:30 GMT+04:00 Yannick Vaucher <yannick.vaucher@camptocamp.com>:
Also, you can use self.browse() to create an empty recordset that you could lately populate when filtering.

In case when it's not @api.one, right?


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




--
Yannick Vaucher
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 30
Office: +41 21 619 10 10