Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
6781 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore Risposta migliore

Mohamed Lamine,

It works perfectly !

I didn't realize that translations are not inherited.

Thank you so much !

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
apr 21
1768
1
mar 25
25587
1
dic 22
10450
4
mar 20
3773
1
ago 16
10514