跳至内容
菜单
此问题已终结
1 回复
428 查看

Hi, im making a custom pdf report in Spanish, but when i create the pdf, it seem like is not in utf-8. It look like this.

Lenguajes de marcas y sistemas de gestión de información.

I been trying to find, what i can do but i dont find anything.
Here i leave the template.

<?xml version="1.0" encoding="UTF-8"?>

<odoo>

    <template id="report_matricula_document" t-name="gestor_de_matriculas.report_matricula_document">

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

            <t t-foreach="docs" t-as="o">

                <div class="page">

                    <style>

                        * {

                            font-family: DejaVu Sans, sans-serif;

                        }

                    </style>


                    <div class="header">

                        <table style="width:100%;">

                            <tr>

                                <td style="width:20%">

                                    <img t-att-src="'/web/image/res.company/' + str(o.env.user.company_id.id) + '/logo'"

                                         style="max-height:60px;"/>

                                </td>

                                <td style="width:80%; text-align:center">

                                    <h2>

                                        <span t-esc="o.env.user.company_id.name"/>

                                    </h2>

                                </td>

                            </tr>

                        </table>

                    </div>


                    <div class="titulo" style="margin-top:10px">

                        <h3>DATOS DE MATRÍCULA</h3>

                    </div>


                    <table class="table table-sm" style="width:100%; border-collapse: collapse;">

                        <tr>

                            <td><strong>Referencia:</strong></td>

                            <td><span t-esc="o.name"/></td>

                            <td><strong>Fecha:</strong></td>

                            <td><span t-esc="o.create_date and o.create_date.strftime('%d/%m/%Y') or ''"/></td>

                        </tr>

                        <tr>

                            <td><strong>Alumno:</strong></td>

                            <td><span t-esc="o.alumno.name + ' ' + o.alumno.lastName"/></td>

                            <td><strong>DNI/NIE:</strong></td>

                            <td><span t-esc="o.alumno.dni_nie"/></td>

                        </tr>

                        <tr>

                            <td><strong>Fecha Nac.:</strong></td>

                            <td><span t-esc="o.alumno.date_birth and o.alumno.date_birth.strftime('%d/%m/%Y') or ''"/></td>

                            <td><strong>Teléfono:</strong></td>

                            <td><span t-esc="o.alumno.phone"/></td>

                        </tr>

                        <tr>

                            <td><strong>Dirección:</strong></td>

                            <td colspan="3"><span t-esc="o.alumno.adress"/></td>

                        </tr>

                        <tr>

                            <td><strong>Email:</strong></td>

                            <td colspan="3"><span t-esc="o.alumno.email"/></td>

                        </tr>

                    </table>


                    <div class="titulo" style="margin-top:10px">

                        <h3>CURSO</h3>

                    </div>


                    <table class="table table-sm" style="width:100%; border-collapse: collapse;">

                        <tr>

                            <td><strong>Curso:</strong></td>

                            <td><span t-esc="o.curso_id.name"/></td>

                            <td><strong>ID Curso:</strong></td>

                            <td><span t-esc="o.curso_id.id_course"/></td>

                        </tr>

                        <tr>

                            <td><strong>Promoción:</strong></td>

                            <td><span t-esc="o.curso_id.promotion"/></td>

                            <td><strong>Estado Académico:</strong></td>

                            <td><span t-esc="dict(o._fields['state'].selection).get(o.state)"/></td>

                        </tr>

                    </table>


                    <div t-if="o.asignaturas_convalidadas_ids" style="margin-top:10px">

                        <div class="titulo">

                            <h3>ASIGNATURAS CONVALIDADAS</h3>

                        </div>

                        <table class="table table-sm" style="width:100%; border-collapse: collapse;">

                            <thead>

                                <tr style="background-color: #f0f0f0;">

                                    <th>Asignatura</th>

                                </tr>

                            </thead>

                            <tbody>

                                <tr t-foreach="o.asignaturas_convalidadas_ids" t-as="asig">

                                    <td><span t-esc="asig.name"/></td>

                                </tr>

                            </tbody>

                        </table>

                    </div>


                    <div class="footer" style="margin-top:30px; text-align:right;">

                        <p>______________________________</p>

                        <p>Firma del Colegio</p>

                    </div>

                </div>

            </t>

        </t>

    </template>

</odoo>





形象
丢弃
最佳答案

In general: You really shouldn't write your views - or any source code for that matter - in a language other than English. Use a translation file to make it multi-lingual. See https://www.odoo.com/documentation/18.0/developer/howtos/translations.html

Since 'Lenguajes de marcas y sistemas de gestión de información' translates to 'Markup languages and information management systems.' I assume this is just a show case of what 'ó' becomes (=>'ó') and it's not related to the actual content of your report.

Therefore, about, for example, 'Dirección' supposedly being rendered as 'Dirección', replace 'ó' with '&oacute;' and perform a similar change to all special characters. A list of entities to be used as a replacement can be found for example in https://www.w3schools.com/CHARSETS/ref_utf_latin1_supplement.asp.

形象
丢弃
相关帖文 回复 查看 活动
0
6月 25
81
2
5月 25
949
1
5月 25
573
0
4月 25
776
1
4月 25
778