Skip to content

Commit 39c908e

Browse files
committed
[MIG] l10n_it_financial_statements_report: Migration to 18.0
1 parent cab0853 commit 39c908e

File tree

16 files changed

+210
-135
lines changed

16 files changed

+210
-135
lines changed

l10n_it_financial_statements_report/README.rst

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ ITA - Stato patrimoniale e conto economico
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
20-
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_financial_statements_report
20+
:target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_financial_statements_report
2121
:alt: OCA/l10n-italy
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_financial_statements_report
23+
:target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_financial_statements_report
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -98,7 +98,7 @@ Bug Tracker
9898
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
9999
In case of trouble, please check there if your issue has already been reported.
100100
If you spotted it first, help us to smash it by providing a detailed and welcomed
101-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_financial_statements_report%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
101+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_financial_statements_report%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
102102

103103
Do not contact contributors directly about support or help with technical issues.
104104

@@ -113,22 +113,26 @@ Authors
113113
Contributors
114114
------------
115115

116-
- Silvio Gregorini <https://github.com/SilvioGregorini>
117-
- `Ooops <https://www.ooops404.com>`__
118-
- `TAKOBI <https://takobi.online>`__:
116+
- Silvio Gregorini <https://github.com/SilvioGregorini>
117+
- `Ooops <https://www.ooops404.com>`__
118+
- `TAKOBI <https://takobi.online>`__:
119119

120-
- Simone Rubino <sir@takobi.online>
120+
- Simone Rubino <sir@takobi.online>
121121

122-
- `Aion Tech <https://aiontech.company/>`__:
122+
- `Aion Tech <https://aiontech.company/>`__:
123123

124-
- Simone Rubino <simone.rubino@aion-tech.it>
124+
- Simone Rubino <simone.rubino@aion-tech.it>
125+
126+
- `Stesi Consulting <https://www.stesi.consulting>`__:
127+
128+
- Michele Di Croce <dicroce.m@stesi.consulting>
125129

126130
Other credits
127131
-------------
128132

129133
The development of this module has been financially supported by:
130134

131-
- Odoo Italia Network
135+
- Odoo Italia Network
132136

133137
Maintainers
134138
-----------
@@ -143,6 +147,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
143147
mission is to support the collaborative development of Odoo features and
144148
promote its widespread use.
145149

146-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_financial_statements_report>`_ project on GitHub.
150+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_financial_statements_report>`_ project on GitHub.
147151

148152
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_it_financial_statements_report/__manifest__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
# Copyright 2019 Alessandro Camilli (alessandrocamilli@openforce.it)
33
# Copyright 2019 Silvio Gregorini (silviogregorini@openforce.it)
44
# Copyright 2023 Simone Rubino - Aion Tech
5+
# Copyright 2025 Michele Di Croce - Stesi Consulting Srl
56
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
67

78
{
89
"name": "ITA - Stato patrimoniale e conto economico",
910
"summary": "Rendicontazione .pdf e .xls per stato patrimoniale e conto"
1011
" economico a sezioni contrapposte",
11-
"version": "16.0.1.0.5",
12+
"version": "18.0.1.0.0",
1213
"category": "Localization/Italy",
1314
"author": "Odoo Community Association (OCA), Openforce",
1415
"website": "https://github.com/OCA/l10n-italy"
@@ -23,10 +24,4 @@
2324
"report/reports.xml",
2425
"wizard/wizard_financial_statements_report.xml",
2526
],
26-
"assets": {
27-
"web.assets_backend": [
28-
"l10n_it_financial_statements_report/static/src/js/action_manager_report.js",
29-
"l10n_it_financial_statements_report/static/src/js/client_action.js",
30-
],
31-
},
3227
}

l10n_it_financial_statements_report/migrations/16.0.1.0.1/post-migrate.py

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
22

3-
from . import account_account
3+
from . import account_account, account_group

l10n_it_financial_statements_report/models/account_account.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,34 @@
3636
"equity",
3737
],
3838
}
39+
ACCOUNT_TYPES_NEGATIVE_SIGN = [
40+
"equity_unaffected",
41+
"equity",
42+
"income",
43+
"income_other",
44+
"liability_payable",
45+
"liability_credit_card",
46+
"asset_prepayments",
47+
"liability_current",
48+
"liability_non_current",
49+
]
3950

4051

4152
class Account(models.Model):
4253
_inherit = "account.account"
4354

55+
account_balance_sign = fields.Integer(
56+
string="Balance sign", compute="_compute_account_balance_sign"
57+
)
58+
59+
@api.depends("account_type")
60+
def _compute_account_balance_sign(self):
61+
for account in self:
62+
if account.account_type in ACCOUNT_TYPES_NEGATIVE_SIGN:
63+
account.account_balance_sign = -1
64+
else:
65+
account.account_balance_sign = 1
66+
4467
# This field is almost equal to `internal_group`; yet, we wanna keep the
4568
# report independent from Odoo's accounting workflow, so we'll use this
4669
# new field for the report
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from odoo import fields, models
2+
3+
4+
class AccountGroup(models.Model):
5+
_inherit = "account.group"
6+
account_balance_sign = fields.Integer(
7+
compute="_compute_account_balance_sign",
8+
string="Balance sign",
9+
)
10+
11+
def _compute_account_balance_sign(self):
12+
for group in self:
13+
group.account_balance_sign = group.get_account_balance_sign()
14+
15+
def get_account_balance_sign(self):
16+
self.ensure_one()
17+
progenitor = self.get_group_progenitor()
18+
accounts = progenitor.get_group_accounts()
19+
if accounts:
20+
return accounts[0].account_balance_sign
21+
return 1
22+
23+
def get_group_accounts(self):
24+
"""Retrieves every account from `self` and `self`'s subgroups."""
25+
return (self + self.get_group_subgroups()).mapped("account_ids")
26+
27+
def get_group_progenitor(self):
28+
self.ensure_one()
29+
if not self.parent_id:
30+
return self
31+
return self.get_group_parents().filtered(lambda g: not g.parent_id)
32+
33+
def get_group_parents(self):
34+
"""
35+
Retrieves every parent for group `self`.
36+
:return: group's parents as recordset, or empty recordset if `self`
37+
has no parents. If a recursion is found, an error is raised.
38+
"""
39+
self.ensure_one()
40+
parent_ids = []
41+
parent = self.parent_id
42+
while parent:
43+
parent_ids.append(parent.id)
44+
parent = parent.parent_id
45+
return self.browse(parent_ids)
46+
47+
def get_group_subgroups(self):
48+
"""Retrieves every subgroup for groups `self`."""
49+
subgroups_ids = self.search([("id", "child_of", self.ids)])
50+
return subgroups_ids

l10n_it_financial_statements_report/readme/CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
- Simone Rubino \<<sir@takobi.online>\>
55
- [Aion Tech](https://aiontech.company/):
66
- Simone Rubino \<<simone.rubino@aion-tech.it>\>
7+
- [Stesi Consulting](https://www.stesi.consulting):
8+
- Michele Di Croce \<<dicroce.m@stesi.consulting>\>

l10n_it_financial_statements_report/report/financial_statements_report_xlsx.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,9 @@ def format_value_by_lang(self, lang, value=None, decimals=None):
598598
"""Mimics `res.lang` model's `format` method"""
599599
percent = f"%.{decimals or 2}f"
600600
value = value or 0
601-
return lang.format(percent, value, grouping=True, monetary=True)
601+
602+
lang = self.env["res.lang"].browse(lang.get("id"))
603+
return lang.format(percent, value, grouping=True)
602604

603605
def get_indent_data(self, line=None, col_dict=None):
604606
return col_dict.get("indent_field"), col_dict.get("indent_unit")

l10n_it_financial_statements_report/report/templates/financial_statements_report.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<t t-call="web.external_layout">
2020
<t t-set="company" t-value="o.company_id" />
2121
<link
22-
href="/account_financial_report/static/src/css/report.css"
22+
href="/l10n_it_financial_statements_report/static/src/css/report.css"
2323
rel="stylesheet"
2424
/>
2525
<t

l10n_it_financial_statements_report/static/description/index.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">ITA - Stato patrimoniale e conto economico</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:d6034c4a0f66d66bdd4e5ae592df81560bedcc305555d998a6ea21eac82019ab
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_financial_statements_report"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_financial_statements_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_financial_statements_report"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_financial_statements_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p><strong>Italiano</strong></p>
374374
<p>Rendicontazione PDF e XLS per stato patrimoniale e conto economico a
375375
sezioni contrapposte.</p>
@@ -435,7 +435,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
435435
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
436436
In case of trouble, please check there if your issue has already been reported.
437437
If you spotted it first, help us to smash it by providing a detailed and welcomed
438-
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_financial_statements_report%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
438+
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_financial_statements_report%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
439439
<p>Do not contact contributors directly about support or help with technical issues.</p>
440440
</div>
441441
<div class="section" id="credits">
@@ -459,6 +459,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
459459
<li>Simone Rubino &lt;<a class="reference external" href="mailto:simone.rubino&#64;aion-tech.it">simone.rubino&#64;aion-tech.it</a>&gt;</li>
460460
</ul>
461461
</li>
462+
<li><a class="reference external" href="https://www.stesi.consulting">Stesi Consulting</a>:<ul>
463+
<li>Michele Di Croce &lt;<a class="reference external" href="mailto:dicroce.m&#64;stesi.consulting">dicroce.m&#64;stesi.consulting</a>&gt;</li>
464+
</ul>
465+
</li>
462466
</ul>
463467
</div>
464468
<div class="section" id="other-credits">
@@ -477,7 +481,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
477481
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
478482
mission is to support the collaborative development of Odoo features and
479483
promote its widespread use.</p>
480-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_financial_statements_report">OCA/l10n-italy</a> project on GitHub.</p>
484+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_financial_statements_report">OCA/l10n-italy</a> project on GitHub.</p>
481485
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
482486
</div>
483487
</div>

0 commit comments

Comments
 (0)