Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][ADD] account_financial_report_start_end_dates #1186

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions account_financial_report_start_end_dates/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Matthieu SAISON <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import report
23 changes: 23 additions & 0 deletions account_financial_report_start_end_dates/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Matthieu SAISON <[email protected]>
# 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",
}
59 changes: 59 additions & 0 deletions account_financial_report_start_end_dates/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions account_financial_report_start_end_dates/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import general_ledger
from . import general_ledger_xlsx
44 changes: 44 additions & 0 deletions account_financial_report_start_end_dates/report/general_ledger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Matthieu SAISON <[email protected]>
# 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)
move_line_data.update(
{
"start_date": move_line["start_date"],
"end_date": move_line["end_date"],
}
)

return move_line_data

@api.model
def _calculate_centralization(self, centralized_ml, move_line, date_to):
centralized_ml = super()._calculate_centralization(

Check warning on line 25 in account_financial_report_start_end_dates/report/general_ledger.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger.py#L25

Added line #L25 was not covered by tests
centralized_ml, move_line, date_to
)
jnl_id = move_line["journal_id"]
month = move_line["date"].month

Check warning on line 29 in account_financial_report_start_end_dates/report/general_ledger.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger.py#L28-L29

Added lines #L28 - L29 were not covered by tests
for jnl_id in centralized_ml:
for month in centralized_ml[jnl_id]:
centralized_ml[jnl_id][month] |= {

Check warning on line 32 in account_financial_report_start_end_dates/report/general_ledger.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger.py#L32

Added line #L32 was not covered by tests
"start_date": False,
"end_date": False,
}
return centralized_ml

Check warning on line 36 in account_financial_report_start_end_dates/report/general_ledger.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger.py#L36

Added line #L36 was not covered by tests

def _get_ml_fields(self):
ml_fields = super()._get_ml_fields()
res = ml_fields + [
"start_date",
"end_date",
]
return res
Original file line number Diff line number Diff line change
@@ -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

Check warning on line 10 in account_financial_report_start_end_dates/report/general_ledger_xlsx.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger_xlsx.py#L8-L10

Added lines #L8 - L10 were not covered by tests
for k, v in res.items():
if not deb_found:
ures.update({k: v})

Check warning on line 13 in account_financial_report_start_end_dates/report/general_ledger_xlsx.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger_xlsx.py#L13

Added line #L13 was not covered by tests
if v["header"] == _("Debit"):
deb_found = 1
ures.update(

Check warning on line 16 in account_financial_report_start_end_dates/report/general_ledger_xlsx.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger_xlsx.py#L15-L16

Added lines #L15 - L16 were not covered by tests
{k: {"header": _("Start Date"), "field": "start_date", "width": 15}}
)
ures.update(

Check warning on line 19 in account_financial_report_start_end_dates/report/general_ledger_xlsx.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger_xlsx.py#L19

Added line #L19 was not covered by tests
{k + 1: {"header": _("End Date"), "field": "end_date", "width": 15}}
)
if deb_found:
ures.update({k + 2: v})
return ures

Check warning on line 24 in account_financial_report_start_end_dates/report/general_ledger_xlsx.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report_start_end_dates/report/general_ledger_xlsx.py#L23-L24

Added lines #L23 - L24 were not covered by tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_general_ledger_lines"
inherit_id="account_financial_report.report_general_ledger_lines"
>
<xpath expr="//div[@class='act_as_row labels']/div[8]" position="after">
<!--## start_date-->
<div class="act_as_cell amount" style="width: 3.51%;">Start date</div>
<!--## end_date-->
<div class="act_as_cell amount" style="width: 3.51%;">End date</div>
</xpath>

<xpath expr="//div[@class='act_as_row lines']/div[8]" position="after">
<!--## start_date-->
<div class="act_as_cell" />
<!--## end_date-->
<div class="act_as_cell" />
</xpath>

<xpath
expr="//t[@t-foreach=&quot;account_or_group_item_object['move_lines']&quot;]/div/div[8]"
position="after"
>
<!--## start_date-->
<div class="act_as_cell left">
<t t-if="line['id']">
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t t-esc="line['start_date']" t-options="{'widget': 'date'}" />
</span>
</t>
<t t-else="">
<span>
<t t-esc="line['start_date']" t-options="{'widget': 'date'}" />
</span>
</t>
</div>
<!--## end_date-->
<div class="act_as_cell left">
<t t-if="line['id']">
<span
t-att-res-id="line['id']"
res-model="account.move.line"
view-type="form"
>
<t t-esc="line['end_date']" t-options="{'widget': 'date'}" />
</span>
</t>
<t t-else="">
<span>
<t t-esc="line['end_date']" t-options="{'widget': 'date'}" />
</span>
</t>
</div>
</xpath>
</template>
</odoo>
6 changes: 6 additions & 0 deletions setup/account_financial_report_start_end_dates/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading