Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7092 มุมมอง

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"

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 19
6870
1
เม.ย. 16
3365
0
ธ.ค. 15
4542
3
มี.ค. 15
18222
Set report orientation แก้ไขแล้ว
1
มี.ค. 15
14615