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

self.env in Aeroo parser?

By
Raffaele
on 9/3/15, 10:40 AM 724 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"

2

Axel Mendoza

--Axel Mendoza--
10238
| 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 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.

Raffaele
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
1

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
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.

Rgds,

Anil.

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

Raffaele
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
on 9/3/15, 10:05 PM

not enough karma to convert this as an answer.

Raffaele
on 9/4/15, 3:46 AM

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

Anil R. Kesariya
on 9/5/15, 6:14 AM

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

2 follower(s)

Stats

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