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

[8.0] Get report name or id from template

By
José
on 5/31/16, 8:20 AM 258 views

In Odoo 8, I have this report

<report 
id="report_lista_precios"
string="Precios con y sin IVA"
model="product.pricelist"
report_type="qweb-pdf"
file="x_acopio.report_products_prices"
name="x_acopio.report_products_prices"
/>

In the template "x_acopio.report_products_prices", how can I get the "name" and/or "id" attribute of this report?

Thanks!

0

Prakash Sharma

--Prakash Sharma--
815
| 2 1 4
Delhi, India
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 5/31/16, 8:29 AM

Use self.evn.ref in python as below :

self.env.ref('x_acopio.report_products_prices').name
self.env.ref('x_acopio.report_products_prices').id

in Xml you can directly use 

ref('x_acopio.report_products_prices').name
ref('x_acopio.report_products_prices').id

hope it may help in your case.



How can I call these commands from the xml template? If I do I get "QWebException: "'NoneType' object has no attribute 'env'" while evaluating"

José
on 5/31/16, 8:45 AM

i have update my answer , in case of xml just use ref (not self.env.ref)

Prakash Sharma
on 5/31/16, 9:26 AM

I try this, but I get: QWebException: "'NoneType' object is not callable" while evaluating "ref('x_acopio.report_products_prices').id"

José
on 5/31/16, 2:15 PM

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: 5/31/16, 8:20 AM
Seen: 258 times
Last updated: 5/31/16, 8:29 AM