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

Hi,

I have to make some customisations to an odoo13 CE instance. (I'm a python developer  whith 0 knowledge of Odoo)

Following the Odoo documentation and some blog tutorials, I managed to create a custom module. Everything worked pretty smoothly until I tried to override the invoice report.

I wanted to bring some modifications to account.report_invoice_document, so I created a view which inherit from it. It seems to work but the text (column headers...) appears in english instead of french.

I thought I understood how it works, but obviously I'm missing some point.

The minimal template below, should show "Sous-total" instead of "Subtotal"

Any clue ?

Regards


<odoo>
<data>
<template id="my_custom_report_invoice_document" inherit_id="account.report_invoice_document" priority="999">
<t t-set="o" t-value="o.with_context(lang=lang)" /> <!-- Attempt to solve the problem -->
<xpath expr="//div[@class='page']" position="replace">
<div class="page">
<div class="clearfix">
<div id="total" class="row">
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto">
<table class="table table-sm;page-break-inside: avoid;">
<tr class="border-black o_subtotal" style="">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" />
</td>
</tr>
<t t-foreach="o.amount_by_group" t-as="amount_by_group">
<tr style="">
<t
t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) == 1 and o.amount_untaxed == amount_by_group[2]">
<td><span t-esc="amount_by_group[0]" /></td>
<td class="text-right o_price_total">
<span t-esc="amount_by_group[3]" />
</td>
</t>
<t t-else="">
<td>
<span t-esc="amount_by_group[0]" />
<span>&amp;nbsp;<span>on</span>
<t t-esc="amount_by_group[4]" />
</span>
</td>
<td class="text-right o_price_total">
<span t-esc="amount_by_group[3]" />
</td>
</t>
</tr>
</t>
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-field="o.amount_total" />
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</xpath>
</template>
</data>
</odoo>


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

Hello,

You must generate a .po file for your personalized module which corresponds to your language (fr.po file in your case) and then add the terms translated into this file. Please find below the steps to generate this file.

If you have already generated this file and it still does not work then share this file.

How to generate module translation file (.po):

1- Enable the developer mode.

2- Go to Settings/Translations/Export Translation.

3- Select the Language (Frensh in your case), Select PO file as File Format and choose you custom module on the Apps To Export field.

4. Click on Export then click on the file name to download it.

5. Copy/Past the file into your custom module under l10n folder.

6. You will find in this file all untranslated terms and you need just to put the right translation of each term.

Good luck!

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Mohamed Lamine,

It works perfectly !

I didn't realize that translations are not inherited.

Thank you so much !

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 21
1830
1
มี.ค. 25
25686
1
ธ.ค. 22
10536
Problem with backend and frontend fields แก้ไขแล้ว
4
มี.ค. 20
3840
XPath Check if element exist แก้ไขแล้ว
1
ส.ค. 16
10595