Odoo Help


self.env in Aeroo parser?

on 9/3/15, 10:40 AM 1,565 views

in v8 which is the best way to reference to another model from within a parser?

Eg. I need to reference ir.config_parameter, but using self.env['ir.config_parameter'] I get error from Aeroo "env is not defined"


Axel Mendoza

--Axel Mendoza--
| 7 8 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 and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 9/3/15, 2:18 PM

In your case you can still use self.pool.get

To access self.pool.get I need to import pooler, and in the log it is reported as deprecated.

on 9/3/15, 4:17 PM

no need to import pooler, you just import pooler when you have no other way to access to your db models pool and you need to do it manually. This is not the case

Axel Mendoza
on 9/3/15, 4:55 PM

I write a more extensive explanation of report parsers at: https://www.odoo.com/es_ES/forum/help-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244

Axel Mendoza
on 10/15/15, 5:52 AM

Anil R. Kesariya (Jupical Technologies)

--Anil R. Kesariya (Jupical Technologies)--
| 7 6 8
Rajkot, India
--Anil R. Kesariya (Jupical Technologies)--

Odoo Techno Functional Expert

* Engaged with odoo since May - 2012.

* Customise existing module or develop new module base on customer requirement.

* Played key developer role in many past and running projects.

* Expert in requirement gathering of business and transforming requirement into odoo platform.

* Major expertise in core modules, database, report development and theme development.

* Integration expert.

Linkedin  : https://in.linkedin.com/in/anil-kesariya-97b20a66

Anil R. Kesariya (Jupical Technologies)
On 9/3/15, 12:21 PM

Hi Raffaele,

You can only use self.env inside the class if your class inherits models.model not osv.Model or other objects.

for eg:

from openerp import models 
class class_name(models.Model):
#inside this class self.env can be use.

Updated (5,sept):

rml_parse is class which is defined inside /odoo/openerp/report/report_sxw.py file which is not inherits models.Model it simply inherits Object. So you cannot use self.env inside the parser class.

Hope this will help.



Aeroo parser inherits report_sxw.rml_parse. https://github.com/gisce/aeroo/blob/master/report_aeroo_sample/report/parser.py

on 9/3/15, 4:03 PM

rml_parse is class which is defined inside /odoo/openerp/report/report_sxw.py file which is not inherits models.Model it simply inherits Object. So you cannot use self.env inside the parser class.

Anil R. Kesariya (Jupical Technologies)
on 9/3/15, 10:05 PM

not enough karma to convert this as an answer.

on 9/4/15, 3:46 AM

Is that your ans? so i will update the in my same ans.

Anil R. Kesariya (Jupical Technologies)
on 9/5/15, 6:14 AM

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.


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

2 follower(s)


Asked: 9/3/15, 10:40 AM
Seen: 1565 times
Last updated: 11/29/15, 2:48 AM