Community mailing list archives

community@mail.odoo.com

Re: [v9] : Call do_search_read as admin user from controller

by
Camptocamp SA, Yannick Vaucher
- 09/15/2016 06:08:16
What about:
super(PFPDataset, self).sudo().do_search_read(model, fields, offset, limit, domain, sort) ?

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

On 14 September 2016 at 16:47, Yassine Teimi <yteimi01@gmail.com> wrote:
Dears,

I'm overriding search_read like the following :

Images intégrées 1

I want to call do_search_read as admin user.

I tried :

super(PFPDataset, self.sudo())do_search_read(model, fields, offset, limit, domain, sort)

and :

super(PFPDataset, self)do_search_read(model.sudo(), fields, offset, limit, domain, sort)

But it's not working. My purpose is to bypass record rules when it's admin user.

How to perform self.sudo() from a controller ?

Thanks a lot.
--

Cordialement

Yassine TEIMI

Consultant & Odoo Project Manager
TEL : +212 6-87 71 41 18

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