Skip to Content
Menu
This question has been flagged

Hello, I'm developing a custom module in Odoo 13 to generate a personalized XMLS report, and  for this I'm using Base Report XLSX from OCA. The issue is that when generating the PO document for the translations, it doesn't recognize the variables that I explicitly marked to export whit "_()", even though I followed all the indications in the official documentation (I think).

 

The custom module code:

# -*- coding: utf-8 -*-

from odoo import models, _

class PayrollBatchReportXLSX(models.AbstractModel):

    _name = 'report.company_payroll.payroll_batch_report'

    _inherit = 'report.report_xlsx.abstract'

    def generate_xlsx_report(self, workbook, data, lines):

        sheet = workbook.add_worksheet('Payroll Batch XLSX Report')

        sheet.write(0, 0, _("ACCOUNT"))

        sheet.write(0, 1, _("DEBIT"))

        sheet.write(0, 2, _("CREDIT"))

        sheet.write(0, 3, _("NAME"))

        line_index = 0

        for line_item in lines.slip_ids.line_ids:

            if line_item.salary_rule_id.category_id.code in ['L10N_HN_NET']:

                sheet.write(line_index+1, 2, line_item.total)

                line_index += 1

        for index, employee in enumerate(lines.slip_ids.employee_id):

            sheet.write(index+1, 3, employee.name.upper())

            if employee.bank_account_id.acc_number:

                sheet.write(index+1, 0, employee.bank_account_id.acc_number)

 

And this is the generated PO file:

# Translation of Odoo Server.

# This file contains the translation of the following modules:

#  * company_payroll

#

msgid ""

msgstr ""

"Project-Id-Version: Odoo Server 13.0+e\n"

"Report-Msgid-Bugs-To: \n"

"POT-Creation-Date: 2022-05-04 16:17+0000\n"

"PO-Revision-Date: 2022-05-04 16:17+0000\n"

"Last-Translator: \n"

"Language-Team: \n"

"MIME-Version: 1.0\n"

"Content-Type: text/plain; charset=UTF-8\n"

"Content-Transfer-Encoding: \n"

"Plural-Forms: \n"

#. module: company_payroll

#: model:ir.actions.report,print_report_name:company_payroll.payroll_batch_xlsx_report

msgid "'Payroll batch - %s' % (object.name)"

msgstr "'Nómina en lote - %s' % (object.name)"

#. module: company_payroll

#: model:ir.model.fields,field_description:company_payroll.field_report_company_payroll_payroll_batch_report__display_name

msgid "Display Name"

msgstr "Mostrar nombre"

#. module: company_payroll

#: model:ir.model.fields,field_description:company_payroll.field_report_company_payroll_payroll_batch_report__id

msgid "ID"

msgstr ""

#. module: company_payroll

#: model:ir.model.fields,field_description:company_payroll.field_report_company_payroll_payroll_batch_report____last_update

msgid "Last Modified on"

msgstr "Última modificación en"

#. module: company_payroll

#: model:ir.actions.report,name:company_payroll.payroll_batch_xlsx_report

msgid "Payroll Batch XLSX Report"

msgstr "Reporte de nómina por lote"

#. module: company_payroll

#: model:ir.model,name:company_payroll.model_report_company_payroll_payroll_batch_report

msgid "report.company_payroll.payroll_batch_report"

msgstr ""

 

As you can see, the variables to be translated ("_("ACCOUNT")", "_("DEBIT")", etc.) aren't shown anywhere. I hope you can help me, thanks in advance.


Avatar
Discard
Related Posts Replies Views Activity
0
Aug 24
252
0
Oct 19
2175
0
Sep 19
83
2
Nov 18
5929
1
Mar 15
3956