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

In QWEB report i have a piece of code like this

<div class="col-3 mb4">

<t t-if="o.company_selection" t-set="company_logo" t-value="o.get_logo(o.company_selection)">
<img t-if="company.logo" t-att-src="image_data_uri(company_logo)" style="max-height: 45px;" alt="Logo"/>
</t>

<t t-if="not o.company_selection">
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/>
</t>
</div>

<div class="col-9 text-right" style="margin-top:22px;">

<t t-if="o.company_selection" t-set="company_name" t-value="o.get_header(o.company_selection)">
<t t-esc="company_name"/>
</t>

<t t-if="not o.company_selection">
<t t-esc="company.report_header"/>
</t>
</div>

When the company_selection is empty it works fine, when it has value the method call is working fine and the python method even returns the value but the value is not being shown in the report. For testing purposes i have placed a <h1> tag inside if as below

<t t-if="o.company_selection" t-set="company_logo" t-value="o.get_logo(o.company_selection)">
<h1>Hello</h1>
</t>

The call to the python method get_logo works but the h1 won't display, why? whats wrong in this code?

الصورة الرمزية
إهمال
أفضل إجابة
<t t-if="o.company_selection">
<h1>Hello</h1>
</t>

check above and let me know.
الصورة الرمزية
إهمال
الكاتب

Hi Rishan,

This code works but when i call a method why is not working? Funny thing is the method in the python code is also gets executed but won't show in view.

could you share your method here and can we know about your requirement?

also try this -

<t t-if="o.company_selection">

<img t-att-src="image_data_uri(o.get_logo(o.company_selection)" style="max-height: 45px;" alt="Logo"/>

</t>

الكاتب

Oddly enough

<img t-if="company.logo" t-att-src="image_data_uri(o.get_logo(o.company_selection))">

worked.

Maybe I had the syntax wrong. Anyway, Thanks Rishan!

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 24
11355
7
أبريل 23
28295
1
يناير 24
1794
1
يونيو 23
4223
1
أبريل 22
9420