Odoo Help

Welcome!

This community 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.

0

Oddo V8 : Inherited BaseModel browse() goes in recursion

By
Khatir Metahri
on 12/22/15, 1:33 PM 496 views

Hello

This is my Pb :

I have inherited the model hr.employee and I want to overload browse method to display only certain employees.

So I did this :

 class hr_employee(models.Model):
_name = 'hr.employee'
_inherit = 'hr.employee'
#...
@api.multi
def browse(self, arg):
return super(hr_employee, self).browse([5,6,7])

 

But as you can imagine, I have not the desired result.

Here is the log :

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 362, in old_api
recs = self.browse(cr, uid, ids, context)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 362, in old_api
recs = self.browse(cr, uid, ids, context)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
RuntimeError: maximum recursion depth exceeded

 

Can you help me please ?


0
Khatir Metahri
On 12/23/15, 4:00 AM

Hi Axel,

I tried your solution, but I have the same error. 


hi, try : return self.env['res.employee'].browse(5, 6, 7)

Guillaume Seran
on 12/23/15, 9:14 AM

Hi Guillaume, I tried this but had the same error.

Khatir Metahri
on 12/23/15, 9:43 AM
0

Axel Mendoza

--Axel Mendoza--
10318
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 12/22/15, 2:36 PM

@Khatir Metahri
You need to call directly the browse method of models.Model, like:

class hr_employee(models.Model):

_name = 'hr.employee'

_inherit = 'hr.employee'

#...

@api.multi

def browse(self, arg):

return models.Model.browse(self,[5,6,7])

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/22/15, 1:33 PM
Seen: 496 times
Last updated: 12/23/15, 4:00 AM