Skip to content

Commit

Permalink
init module
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu.saison committed Jun 4, 2024
1 parent 5046194 commit e5fc53a
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 0 deletions.
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
40 changes: 40 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,40 @@
# 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)
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
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
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
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,
)

0 comments on commit e5fc53a

Please sign in to comment.