Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
6718 Zobrazení

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>


Avatar
Zrušit
Nejlepší odpověď

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!

Avatar
Zrušit
Autor Nejlepší odpověď

Mohamed Lamine,

It works perfectly !

I didn't realize that translations are not inherited.

Thank you so much !

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
dub 21
1730
1
bře 25
25495
1
pro 22
10355
4
bře 20
3699
1
srp 16
10424