diff --git a/account_financial_report_start_end_dates/__init__.py b/account_financial_report_start_end_dates/__init__.py new file mode 100644 index 000000000000..787488405559 --- /dev/null +++ b/account_financial_report_start_end_dates/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2024 Akretion (https://www.akretion.com). +# @author Matthieu SAISON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import report diff --git a/account_financial_report_start_end_dates/__manifest__.py b/account_financial_report_start_end_dates/__manifest__.py new file mode 100644 index 000000000000..eb82e1a1ffa2 --- /dev/null +++ b/account_financial_report_start_end_dates/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2024 Akretion (https://www.akretion.com). +# @author Matthieu SAISON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Account Financial Reports Start and End dates", + "version": "14.0.1.0.0", + "category": "Reporting", + "summary": "OCA Financial Reports", + "author": "Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-financial-reporting", + "depends": [ + "account", + "account_financial_report", + "account_invoice_start_end_dates", + ], + "data": [ + "report/templates/general_ledger.xml", + ], + "installable": True, + "application": True, + "auto_install": False, + "license": "AGPL-3", +} diff --git a/account_financial_report_start_end_dates/i18n/fr.po b/account_financial_report_start_end_dates/i18n/fr.po new file mode 100644 index 000000000000..e9e660f46897 --- /dev/null +++ b/account_financial_report_start_end_dates/i18n/fr.po @@ -0,0 +1,59 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_financial_report_start_end_dates +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-05-31 13:46+0000\n" +"PO-Revision-Date: 2024-05-31 13:46+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: account_financial_report_start_end_dates +#: code:addons/account_financial_report_start_end_dates/report/general_ledger_xlsx.py:0 +#, python-format +msgid "Debit" +msgstr "Débit" + +#. module: account_financial_report_start_end_dates +#: model:ir.model.fields,field_description:account_financial_report_start_end_dates.field_report_account_financial_report_general_ledger__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: account_financial_report_start_end_dates +#: code:addons/account_financial_report_start_end_dates/report/general_ledger_xlsx.py:0 +#, python-format +msgid "End Date" +msgstr "Date de fin" + +#. module: account_financial_report_start_end_dates +#: model_terms:ir.ui.view,arch_db:account_financial_report_start_end_dates.report_general_ledger_lines +msgid "End date" +msgstr "Date de fin" + +#. module: account_financial_report_start_end_dates +#: model:ir.model,name:account_financial_report_start_end_dates.model_report_account_financial_report_general_ledger +msgid "General Ledger Report" +msgstr "Etat du Grand livre" + +#. module: account_financial_report_start_end_dates +#: model:ir.model.fields,field_description:account_financial_report_start_end_dates.field_report_account_financial_report_general_ledger____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: account_financial_report_start_end_dates +#: code:addons/account_financial_report_start_end_dates/report/general_ledger_xlsx.py:0 +#, python-format +msgid "Start Date" +msgstr "Date de début" + +#. module: account_financial_report_start_end_dates +#: model_terms:ir.ui.view,arch_db:account_financial_report_start_end_dates.report_general_ledger_lines +msgid "Start date" +msgstr "Date de début" diff --git a/account_financial_report_start_end_dates/report/__init__.py b/account_financial_report_start_end_dates/report/__init__.py new file mode 100644 index 000000000000..d93f0313e368 --- /dev/null +++ b/account_financial_report_start_end_dates/report/__init__.py @@ -0,0 +1,2 @@ +from . import general_ledger +from . import general_ledger_xlsx diff --git a/account_financial_report_start_end_dates/report/general_ledger.py b/account_financial_report_start_end_dates/report/general_ledger.py new file mode 100644 index 000000000000..bec08bf0abe3 --- /dev/null +++ b/account_financial_report_start_end_dates/report/general_ledger.py @@ -0,0 +1,40 @@ +# Copyright 2024 Akretion (https://www.akretion.com). +# @author Matthieu SAISON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class GeneralLedgerReport(models.AbstractModel): + _inherit = "report.account_financial_report.general_ledger" + + @api.model + def _get_move_line_data(self, move_line): + move_line_data = super()._get_move_line_data(move_line) + return move_line_data | { + "start_date": move_line["start_date"], + "end_date": move_line["end_date"], + } + + @api.model + def _calculate_centralization(self, centralized_ml, move_line, date_to): + centralized_ml = super()._calculate_centralization( + centralized_ml, move_line, date_to + ) + jnl_id = move_line["journal_id"] + month = move_line["date"].month + for jnl_id in centralized_ml: + for month in centralized_ml[jnl_id]: + centralized_ml[jnl_id][month] |= { + "start_date": False, + "end_date": False, + } + return centralized_ml + + def _get_ml_fields(self): + ml_fields = super()._get_ml_fields() + res = ml_fields + [ + "start_date", + "end_date", + ] + return res diff --git a/account_financial_report_start_end_dates/report/general_ledger_xlsx.py b/account_financial_report_start_end_dates/report/general_ledger_xlsx.py new file mode 100644 index 000000000000..c3bc29938049 --- /dev/null +++ b/account_financial_report_start_end_dates/report/general_ledger_xlsx.py @@ -0,0 +1,24 @@ +from odoo import _, models + + +class GeneralLedgerXslx(models.AbstractModel): + _inherit = "report.a_f_r.report_general_ledger_xlsx" + + def _get_report_columns(self, report): + res = super()._get_report_columns(report) + ures = {} + deb_found = 0 + for k, v in res.items(): + if not deb_found: + ures |= {k: v} + if v["header"] == _("Debit"): + deb_found = 1 + ures |= { + k: {"header": _("Start Date"), "field": "start_date", "width": 15} + } + ures |= { + k + 1: {"header": _("End Date"), "field": "end_date", "width": 15} + } + if deb_found: + ures |= {k + 2: v} + return ures diff --git a/account_financial_report_start_end_dates/report/templates/general_ledger.xml b/account_financial_report_start_end_dates/report/templates/general_ledger.xml new file mode 100644 index 000000000000..90b3047b0f8f --- /dev/null +++ b/account_financial_report_start_end_dates/report/templates/general_ledger.xml @@ -0,0 +1,61 @@ + + + + diff --git a/setup/account_financial_report_start_end_dates/odoo/addons/account_financial_report_start_end_dates b/setup/account_financial_report_start_end_dates/odoo/addons/account_financial_report_start_end_dates new file mode 120000 index 000000000000..5cd61a0a7e21 --- /dev/null +++ b/setup/account_financial_report_start_end_dates/odoo/addons/account_financial_report_start_end_dates @@ -0,0 +1 @@ +../../../../account_financial_report_start_end_dates \ No newline at end of file diff --git a/setup/account_financial_report_start_end_dates/setup.py b/setup/account_financial_report_start_end_dates/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/account_financial_report_start_end_dates/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)