تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6869 أدوات العرض

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!

الصورة الرمزية
إهمال
أفضل إجابة

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"

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

الكاتب

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يوليو 19
6801
1
أبريل 16
3276
0
ديسمبر 15
4420
3
مارس 15
18003
1
مارس 15
14463