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

In QWEB we access fields using o, i want to know which model's record set is 'o' currently set to. Is there any way to know this?

I want to do something like this

if o.model_name==account.invoice

do

something

else

some other thing.

Please let me know if i can do soemthing like this or not?

Also someone tell me what exactly is o and what does it contain?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

hello

you can print or know model name using <span t-esc="o._name"/>.

for eg. <t t-if="o._name == 'account.invoice'">  # for check the model name
 

The 'o' is defined variable by odoo, and it is recordset which is you select the record while print the report.


อวตาร
ละทิ้ง
ผู้เขียน

+1, exactly what i was looking for! Thanks :)

คำตอบที่ดีที่สุด

for get the model of the qweb report follow bellow steps,

- activate the developer mode

- open the setting app and follow bellow path 

Technical -> Reporting

- under the reporting section find your report and open it.

- then you can found the related Model there.


 

อวตาร
ละทิ้ง
ผู้เขียน

Mitul's answer is what i was looking for. Thanks for the help though!

Related Posts ตอบกลับ มุมมอง กิจกรรม
Why doesn't this below code work? แก้ไขแล้ว
1
เม.ย. 19
3612
7
เม.ย. 23
28445
1
ม.ค. 24
1886
1
มิ.ย. 23
4362
1
เม.ย. 22
9517