From dde5426bf2d569dedea0d69bb56805eecb413a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 1 Sep 2022 13:29:29 +0200 Subject: [PATCH] [IMP] account_financial_report: Add "Cumul cur." column to general_ledger. TT38722 --- account_financial_report/README.rst | 1 + .../i18n/account_financial_report.pot | 8 +- account_financial_report/i18n/es.po | 113 ++---------------- .../readme/CONTRIBUTORS.rst | 1 + .../report/abstract_report_xlsx.py | 11 +- .../report/general_ledger_xlsx.py | 28 +++-- .../report/templates/general_ledger.xml | 48 ++++++-- .../static/description/index.html | 3 +- 8 files changed, 78 insertions(+), 135 deletions(-) diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index e6402424..a144b377 100644 --- a/account_financial_report/README.rst +++ b/account_financial_report/README.rst @@ -129,6 +129,7 @@ Contributors * Sergio Teruel * Ernesto Tejeda * Alexandre D. Díaz + * Víctor Martínez * Lois Rilo * `Sygel `__: diff --git a/account_financial_report/i18n/account_financial_report.pot b/account_financial_report/i18n/account_financial_report.pot index dcaca77a..9e0ae59c 100644 --- a/account_financial_report/i18n/account_financial_report.pot +++ b/account_financial_report/i18n/account_financial_report.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-09-01 13:35+0000\n" +"PO-Revision-Date: 2022-09-01 13:35+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -484,6 +486,11 @@ msgstr "" msgid "Credit" msgstr "" +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines +msgid "Cumul cur." +msgstr "" + #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines @@ -496,7 +503,6 @@ msgstr "" #: code:addons/account_financial_report/report/open_items_xlsx.py:0 #: code:addons/account_financial_report/report/trial_balance_xlsx.py:0 #: code:addons/account_financial_report/report/trial_balance_xlsx.py:0 -#: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header #: model_terms:ir.ui.view,arch_db:account_financial_report.report_open_items_lines_header #: model_terms:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header diff --git a/account_financial_report/i18n/es.po b/account_financial_report/i18n/es.po index 27c60f4b..270afb8b 100644 --- a/account_financial_report/i18n/es.po +++ b/account_financial_report/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-05-21 13:00+0000\n" -"PO-Revision-Date: 2022-08-26 19:07+0000\n" +"POT-Creation-Date: 2022-09-01 13:35+0000\n" +"PO-Revision-Date: 2022-09-01 15:36+0200\n" "Last-Translator: Pedro M. Baeza \n" "Language-Team: \n" "Language: es\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Poedit 3.0.1\n" #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_lines_header @@ -506,6 +506,11 @@ msgstr "Creado el" msgid "Credit" msgstr "Haber" +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines +msgid "Cumul cur." +msgstr "Acumulado moneda" + #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines @@ -517,7 +522,6 @@ msgstr "Saldo Acumu." #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: code:addons/account_financial_report/report/open_items_xlsx.py:0 #: code:addons/account_financial_report/report/trial_balance_xlsx.py:0 -#: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header #: model_terms:ir.ui.view,arch_db:account_financial_report.report_open_items_lines_header #: model_terms:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header @@ -1864,104 +1868,3 @@ msgstr "ancho: 38.92%;" #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header msgid "width: 8.11%;" msgstr "ancho: 8.11%;" - -#~ msgid " Export" -#~ msgstr "Exportar" - -#~ msgid " Print" -#~ msgstr "Imprimir" - -#~ msgid "" -#~ "Cost\n" -#~ " center" -#~ msgstr "Centro de Costos" - -#~ msgid "Cost center" -#~ msgstr "Centro de Costos" - -#~ msgid "Account Code" -#~ msgstr "Cuenta" - -#~ msgid "Account ID" -#~ msgstr "Nº Cuenta" - -#~ msgid "Account Type" -#~ msgstr "Tipo de Cuenta" - -#~ msgid "Age 120 Days" -#~ msgstr "120 días" - -#~ msgid "Age 30 Days" -#~ msgstr "30 días" - -#~ msgid "Age 60 Days" -#~ msgstr "60 días" - -#~ msgid "Age 90 Days" -#~ msgstr "90 días" - -#~ msgid "Amount Residual" -#~ msgstr "Importe Inicial" - -#~ msgid "Amount Residual Currency" -#~ msgstr "Moneda de Saldo Pendiente" - -#~ msgid "Amount Total Due" -#~ msgstr "Total" - -#~ msgid "Amount Total Due Currency" -#~ msgstr "Moneda de Total" - -#~ msgid "Centralize" -#~ msgstr "Centralizar" - -#~ msgid "Centralized Entries" -#~ msgstr "Centralizar las entradas" - -#~ msgid "Child accounts" -#~ msgstr "Cuentas Hijas" - -#~ msgid "Company Currency" -#~ msgstr "Moneda de Empresa" - -#~ msgid "Cost Center" -#~ msgstr "Centro de Costos" - -#~ msgid "Cumul Age 120 Days" -#~ msgstr "Acumulado a 120 días" - -#~ msgid "Cumul Age 30 Days" -#~ msgstr "Acumulado a 30 días" - -#~ msgid "Cumul Age 60 Days" -#~ msgstr "Acumulado a 60 días" - -#~ msgid "Cumul Age 90 Days" -#~ msgstr "Acumulado a 90 días" - -#~ msgid "Cumul Amount Residual" -#~ msgstr "Cantidad Residual Acumulada" - -#~ msgid "Cumul Balance" -#~ msgstr "Saldo Acumulado" - -#~ msgid "Cumul Current" -#~ msgstr "Acum. Actual" - -#~ msgid "Cumul Older" -#~ msgstr "Acum. Anterior" - -#~ msgid "Currency Name" -#~ msgstr "Moneda" - -#~ msgid "Date Due" -#~ msgstr "Fecha vencimiento" - -#~ msgid "Ending blance cur." -#~ msgstr "Saldo final." - -#~ msgid "Filter Analytic Tag" -#~ msgstr "Filtrar por Etiqueta Analítica" - -#~ msgid "Filter Cost Center" -#~ msgstr "Filtro Centro de Costos" diff --git a/account_financial_report/readme/CONTRIBUTORS.rst b/account_financial_report/readme/CONTRIBUTORS.rst index 88f89af1..bf5f270a 100644 --- a/account_financial_report/readme/CONTRIBUTORS.rst +++ b/account_financial_report/readme/CONTRIBUTORS.rst @@ -22,6 +22,7 @@ * Sergio Teruel * Ernesto Tejeda * Alexandre D. Díaz + * Víctor Martínez * Lois Rilo * `Sygel `__: diff --git a/account_financial_report/report/abstract_report_xlsx.py b/account_financial_report/report/abstract_report_xlsx.py index 2375fd2f..2abb8494 100644 --- a/account_financial_report/report/abstract_report_xlsx.py +++ b/account_financial_report/report/abstract_report_xlsx.py @@ -458,16 +458,14 @@ class AbstractReportXslx(models.AbstractModel): format_amt = self.format_amount field_prefix = "format_amount" if "currency_id" in line_object and line_object.get("currency_id", False): - field_name = "{}_{}".format(field_prefix, line_object["currency_id"].name) + currency = line_object["currency_id"] + field_name = "{}_{}".format(field_prefix, currency.name) if hasattr(self, field_name): format_amt = getattr(self, field_name) else: format_amt = self.workbook.add_format() self.field_name = format_amt - format_amount = "#,##0." + ( - "0" * line_object["currency_id"].decimal_places - ) - format_amt.set_num_format(format_amount) + format_amt.set_num_format(self._report_xlsx_currency_format(currency)) return format_amt def _get_currency_amt_format_dict(self, line_dict): @@ -489,8 +487,7 @@ class AbstractReportXslx(models.AbstractModel): else: format_amt = self.workbook.add_format() self.field_name = format_amt - format_amount = "#,##0." + ("0" * currency.decimal_places) - format_amt.set_num_format(format_amount) + format_amt.set_num_format(self._report_xlsx_currency_format(currency)) return format_amt def _get_currency_amt_header_format(self, line_object): diff --git a/account_financial_report/report/general_ledger_xlsx.py b/account_financial_report/report/general_ledger_xlsx.py index 4c32d3b1..e4a8722c 100644 --- a/account_financial_report/report/general_ledger_xlsx.py +++ b/account_financial_report/report/general_ledger_xlsx.py @@ -1,6 +1,7 @@ # Author: Damien Crier # Author: Julien Coux # Copyright 2016 Camptocamp SA +# Copyright 2022 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, models @@ -71,20 +72,19 @@ class GeneralLedgerXslx(models.AbstractModel): ] if report.foreign_currency: res += [ - { - "header": _("Cur."), - "field": "currency_name", - "field_currency_balance": "currency_name", - "type": "currency_name", - "width": 7, - }, { "header": _("Amount cur."), "field": "bal_curr", "field_initial_balance": "initial_bal_curr", "field_final_balance": "final_bal_curr", "type": "amount_currency", - "width": 14, + "width": 10, + }, + { + "header": _("Cumul cur."), + "field": "total_bal_curr", + "type": "amount_currency", + "width": 10, }, ] res_as_dict = {} @@ -173,6 +173,7 @@ class GeneralLedgerXslx(models.AbstractModel): self.write_initial_balance_from_dict(account) # Display account move lines + total_bal_curr = 0 for line in account["move_lines"]: line.update( { @@ -197,6 +198,9 @@ class GeneralLedgerXslx(models.AbstractModel): line.update( {"taxes_description": taxes_description, "tags": tags,} ) + if foreign_currency and line["currency_id"]: + total_bal_curr += line["bal_curr"] + line.update({"total_bal_curr": total_bal_curr}) self.write_line_from_dict(line) # Display ending balance line for account account.update( @@ -233,12 +237,13 @@ class GeneralLedgerXslx(models.AbstractModel): } ) if foreign_currency: - partner.update( - {"initial_bal_curr": partner["init_bal"]["bal_curr"],} + account.update( + {"initial_bal_curr": account["init_bal"]["bal_curr"]} ) self.write_initial_balance_from_dict(partner) # Display account move lines + total_bal_curr = 0 for line in partner["move_lines"]: line.update( { @@ -265,6 +270,9 @@ class GeneralLedgerXslx(models.AbstractModel): line.update( {"taxes_description": taxes_description, "tags": tags,} ) + if foreign_currency and line["currency_id"]: + total_bal_curr += line["bal_curr"] + line.update({"total_bal_curr": total_bal_curr}) self.write_line_from_dict(line) # Display ending balance line for partner diff --git a/account_financial_report/report/templates/general_ledger.xml b/account_financial_report/report/templates/general_ledger.xml index be499dc9..5b131cda 100644 --- a/account_financial_report/report/templates/general_ledger.xml +++ b/account_financial_report/report/templates/general_ledger.xml @@ -184,8 +184,13 @@
Amount cur.
+ +
Cumul cur.
@@ -313,7 +318,7 @@ -
+
+
-
+
+
+
@@ -569,12 +577,16 @@
+ + -
- +
+ +
+ +
-
+
+ +
@@ -652,7 +676,7 @@ -
+
+
-
+
+
diff --git a/account_financial_report/static/description/index.html b/account_financial_report/static/description/index.html index fb6094cb..058a8b0e 100644 --- a/account_financial_report/static/description/index.html +++ b/account_financial_report/static/description/index.html @@ -3,7 +3,7 @@ - + Account Financial Reports