diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index 941fa862..5d18de7f 100644 --- a/account_financial_report/README.rst +++ b/account_financial_report/README.rst @@ -130,6 +130,7 @@ Contributors * Ernesto Tejeda * João Marques * Alexandre D. Díaz + * Víctor Martínez * `Sygel `__: diff --git a/account_financial_report/i18n/account_financial_report.pot b/account_financial_report/i18n/account_financial_report.pot index f479a9e0..acf0f7d2 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 14.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" @@ -442,6 +444,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 @@ -454,7 +461,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 f61347d5..fb6bb392 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 @@ -449,6 +449,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 @@ -460,7 +465,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 @@ -1821,168 +1825,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 "Child Accounts" -#~ msgstr "Cuentas Hijas" - -#~ msgid "Computed Accounts" -#~ msgstr "Cuentas Calculadas" - -#~ msgid "" -#~ "Computed Accounts: Use when the account group have codes\n" -#~ " that represent prefixes of the actual accounts.\n" -#~ "\n" -#~ " Child Accounts: Use when your account groups are hierarchical.\n" -#~ "\n" -#~ " No hierarchy: Use to display just the accounts, without any " -#~ "grouping.\n" -#~ " " -#~ msgstr "" -#~ "Cuentas Calculadas: Usar cuando el grupo de cuentas tiene códigos \n" -#~ " que representan prefijos de las cuentas reales.\n" -#~ "\n" -#~ " Cuentas Hijas: Usar cuando los grupos de cuentas son " -#~ "jerárquicos.\n" -#~ "\n" -#~ " Sin jerarquía: Usar para mostrar sólo las cuentas, sin ninguna " -#~ "agrupación.\n" -#~ " " - -#~ msgid "Hierarchy On" -#~ msgstr "Jerarquía en" - -#~ msgid "No hierarchy" -#~ msgstr "Sin jerarquía" - -#~ msgid " Export" -#~ msgstr "Exportar" - -#~ msgid " Print" -#~ msgstr "Imprimir" - -#~ msgid "" -#~ "\n" -#~ " To\n" -#~ " " -#~ msgstr "" -#~ "\n" -#~ " A\n" -#~ " " - -#~ msgid "" -#~ "\n" -#~ " To\n" -#~ " " -#~ msgstr "" -#~ "\n" -#~ " A\n" -#~ " " - -#~ msgid "" -#~ "General Ledger can be computed only if selected company have only one " -#~ "unaffected earnings account." -#~ msgstr "" -#~ "El Libro mayor solo se puede calcular si la empresa seleccionada tiene " -#~ "solo una cuenta de resultados no afectados." - -#~ msgid "" -#~ "Trial Balance can be computed only if selected company have only one " -#~ "unaffected earnings account." -#~ msgstr "" -#~ "El balance de sumas y saldos solo puede calcularse si la compañía " -#~ "seleccionada tiene una y solo una cuenta de ganancias." - -#~ 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 c3dcdc8b..f0bb7b8b 100644 --- a/account_financial_report/readme/CONTRIBUTORS.rst +++ b/account_financial_report/readme/CONTRIBUTORS.rst @@ -23,6 +23,7 @@ * Ernesto Tejeda * João Marques * Alexandre D. Díaz + * Víctor Martínez * `Sygel `__: diff --git a/account_financial_report/report/abstract_report_xlsx.py b/account_financial_report/report/abstract_report_xlsx.py index cc8fea2e..b19566c0 100644 --- a/account_financial_report/report/abstract_report_xlsx.py +++ b/account_financial_report/report/abstract_report_xlsx.py @@ -237,6 +237,22 @@ class AbstractReportXslx(models.AbstractModel): for col_pos, column in report_data["columns"].items(): value = line_dict.get(column["field"], False) cell_type = column.get("type", "string") + # We will use a special cell type according to the currency of + # record and the company's currency: + # - If the currency is the same as the company's currency, we will leave + # the value empty. + # - If the currency is different from the company's currency, we will + # show the value. + if cell_type == "amount_different_company_currency": + if line_dict.get("currency_id") and line_dict.get( + "company_currency_id" + ): + if line_dict["currency_id"] == line_dict["company_currency_id"]: + value = "" + cell_type = "string" + else: + cell_type = "amount_currency" + # All conditions according to cell type. if cell_type == "string": if line_dict.get("type", "") == "group_type": report_data["sheet"].write_string( @@ -529,16 +545,14 @@ class AbstractReportXslx(models.AbstractModel): format_amt = report_data["formats"]["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 = report_data["workbook"].add_format() report_data["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, report_data): @@ -560,8 +574,7 @@ class AbstractReportXslx(models.AbstractModel): else: format_amt = report_data["workbook"].add_format() report_data["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, report_data): diff --git a/account_financial_report/report/general_ledger.py b/account_financial_report/report/general_ledger.py index a3e169ef..05953717 100644 --- a/account_financial_report/report/general_ledger.py +++ b/account_financial_report/report/general_ledger.py @@ -859,4 +859,5 @@ class GeneralLedgerReport(models.AbstractModel): "centralize": centralize, "tags_data": tags_data, "filter_partner_ids": filter_partner_ids, + "currency_model": self.env["res.currency"], } diff --git a/account_financial_report/report/general_ledger_xlsx.py b/account_financial_report/report/general_ledger_xlsx.py index 7f0583a9..b182850f 100644 --- a/account_financial_report/report/general_ledger_xlsx.py +++ b/account_financial_report/report/general_ledger_xlsx.py @@ -2,6 +2,7 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA # Copyright 2021 Tecnativa - João Marques +# Copyright 2022 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, models @@ -72,20 +73,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, + "type": "amount_different_company_currency", + "width": 10, + }, + { + "header": _("Cumul cur."), + "field": "total_bal_curr", + "type": "amount_different_company_currency", + "width": 10, }, ] res_as_dict = {} @@ -148,6 +148,7 @@ class GeneralLedgerXslx(models.AbstractModel): tags_data = res_data["tags_data"] filter_partner_ids = res_data["filter_partner_ids"] foreign_currency = res_data["foreign_currency"] + company_currency = report.company_id.currency_id # For each account for account in general_ledger: # Write account title @@ -175,11 +176,13 @@ class GeneralLedgerXslx(models.AbstractModel): self.write_initial_balance_from_dict(account, report_data) # Display account move lines + total_bal_curr = 0 for line in account["move_lines"]: line.update( { "account": account["code"], "journal": journals_data[line["journal_id"]]["code"], + "company_currency_id": company_currency.id, } ) if line["currency_id"]: @@ -202,6 +205,13 @@ class GeneralLedgerXslx(models.AbstractModel): "tags": tags, } ) + if ( + foreign_currency + and line["currency_id"] + and line["currency_id"] != company_currency.id + ): + total_bal_curr += line["bal_curr"] + line.update({"total_bal_curr": total_bal_curr}) self.write_line_from_dict(line, report_data) # Display ending balance line for account account.update( @@ -250,11 +260,13 @@ class GeneralLedgerXslx(models.AbstractModel): self.write_initial_balance_from_dict(partner, report_data) # Display account move lines + total_bal_curr = 0 for line in partner["move_lines"]: line.update( { "account": account["code"], "journal": journals_data[line["journal_id"]]["code"], + "company_currency_id": company_currency.id, } ) if line["currency_id"]: @@ -279,6 +291,13 @@ class GeneralLedgerXslx(models.AbstractModel): "tags": tags, } ) + if ( + foreign_currency + and line["currency_id"] + and line["currency_id"] != company_currency.id + ): + total_bal_curr += line["bal_curr"] + line.update({"total_bal_curr": total_bal_curr}) self.write_line_from_dict(line, report_data) # 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 bc48f130..1ca2c8a6 100644 --- a/account_financial_report/report/templates/general_ledger.xml +++ b/account_financial_report/report/templates/general_ledger.xml @@ -188,12 +188,16 @@ Cumul. Bal. - -
Cur.
-
- Amount cur. -
+
Amount cur.
+ +
Cumul cur.
@@ -321,12 +325,7 @@ -
- -
-
+
+
-
-
+
+
+
@@ -583,26 +584,43 @@
- -
- -
+ + -
+
- - + t-raw="line['bal_curr']" + t-options="{'widget': 'monetary', 'display_currency': line_currency}" + t-if="line_currency!=company_currency" + /> +
+ +
+
- -
-
+
+ +
@@ -670,12 +688,7 @@ -
- -
-
+
+
-
-
+
+
diff --git a/account_financial_report/static/description/index.html b/account_financial_report/static/description/index.html index b0e82519..5cdc59af 100644 --- a/account_financial_report/static/description/index.html +++ b/account_financial_report/static/description/index.html @@ -3,7 +3,7 @@ - + Account Financial Reports