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

Hello everyone.


I'm working on a QWeb report in Odoo 17, and I've encountered an issue with the currency symbol display.

when I used web.html_container

The currency symbol is displayed incorrectly, e.g., 500.00 ₱ instead of 500.00 ₱. 


but when I used web.basic_layout

The currency symbol is displayed correctly.

Could anyone explain why this is happening and how I can fix the currency symbol display when using web.html_container?


Thanks in advance!

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

Hi,


The incorrect currency symbol display in QWeb reports using web.html_container is often due to character encoding issues. Unlike web.basic_layout, web.html_container might not handle encoding automatically. The "Â" character indicates a UTF-8 encoding problem.


To fix this, start by adding <meta charset="UTF-8"/> to the <head> section of your QWeb template to explicitly set the encoding. Alternatively, use t-esc with formatLang to format the currency value according to the user's language and currency settings. Ensure the report is rendered with the correct language context and verify that your Odoo database uses UTF-8 encoding. If these solutions don't work, consider creating a custom QWeb helper function for currency formatting.


Eg:-

<t t-call="web.html_container">

    <t t-set="data_report_margin_top" t-value="12"/>

    <t t-set="data_report_header_spacing" t-value="9"/>

    <t t-set="data_report_dpi" t-value="110"/>


    <t t-call="web.internal_layout">

        <t t-set="o" t-value="o.with_context({'lang': lang})"/>

        <t t-set="company" t-value="o.company_id"/>

        <t t-set="currency" t-value="company.currency_id"/>

        <div class="header">

            <!-- Header content -->

        </div>

        <div class="article" data-oe-model="your.model" data-oe-id="o.id">

            <head>

                <meta charset="UTF-8"/>  <!-- Add this line -->

            </head>

            <!-- Your report content here -->

        </div>

        <div class="footer text-center">

            <!-- Footer content -->

        </div>

    </t>

</t>


Hope it helps

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

Hi, I had the same issue in odoo 18.0 and resolved it by adding the following

<meta charset="UTF-8"/>

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
فبراير 25
2790
4
يناير 25
45979
0
أكتوبر 24
2239
0
أكتوبر 24
5
1
مايو 23
3836