Skip to content

Commit

Permalink
[REF] l10n_it_account_balance_report: Rename
Browse files Browse the repository at this point in the history
Balance is too generic, Financial statements is what this module is producing
  • Loading branch information
SirTakobi committed Jul 24, 2023
1 parent a381291 commit 1194fb2
Show file tree
Hide file tree
Showing 39 changed files with 1,416 additions and 1,226 deletions.
511 changes: 0 additions & 511 deletions l10n_it_account_balance_report/i18n/it.po

This file was deleted.

504 changes: 0 additions & 504 deletions l10n_it_account_balance_report/i18n/l10n_it_account_balance_report.pot

This file was deleted.

4 changes: 0 additions & 4 deletions l10n_it_account_balance_report/report/__init__.py

This file was deleted.

40 changes: 0 additions & 40 deletions l10n_it_account_balance_report/report/reports.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ ITA - Stato patrimoniale e conto economico
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_account_balance_report
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_financial_statements_report
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_account_balance_report
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_financial_statements_report
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/14.0
Expand All @@ -31,17 +31,28 @@ Rendicontazione PDF e XLS per stato patrimoniale e conto economico a sezioni con

**English**

PDF and XLS reporting for accounting balance sheets.
PDF and XLS reporting for financial statements.

**Table of contents**

.. contents::
:local:

Installation
============

**Italiano**

Se questo modulo viene installato in un ambiente dove `l10n_it_account_balance_report` è presente, lo sostituisce.

**English**

If this module is installed in an instance where `l10n_it_account_balance_report` is present, it replaces it.

Usage
=====

From your Accounting / Report section, select "Account Balance Report".
From your Accounting / Report section, select "Financial Statements Report".

This will trigger a wizard, from which you can setup your report configuration.
From it, you can choose whether should be created, either an HTML interactive view, or a PDF / XLS sheet.
Expand All @@ -52,7 +63,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_account_balance_report%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_financial_statements_report%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand Down Expand Up @@ -93,6 +104,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_account_balance_report>`_ project on GitHub.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_financial_statements_report>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from . import models
from . import report
from . import wizard
from .hooks import pre_absorb_old_module
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"category": "Localization/Italy",
"author": "Odoo Community Association (OCA), Openforce",
"website": "https://github.com/OCA/l10n-italy"
"/tree/14.0/l10n_it_account_balance_report",
"/tree/14.0/l10n_it_financial_statements_report",
"license": "AGPL-3",
"depends": [
"account_financial_report",
Expand All @@ -20,11 +20,17 @@
],
"data": [
"data/account_type.xml",
"report/templates/account_balance_report.xml",
"report/templates/financial_statements_report.xml",
"report/reports.xml",
"views/account_types.xml",
"views/assets.xml",
"wizard/wizard_account_balance_report.xml",
"wizard/wizard_financial_statements_report.xml",
],
"external_dependencies": {
"python": [
"openupgradelib",
],
},
"pre_init_hook": "pre_absorb_old_module",
"installable": True,
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,92 +7,92 @@
"Non-current Assets", "Fixed Assets"
-->
<record model="account.account.type" id="account.data_account_type_receivable">
<field name="account_balance_report_section" eval="'assets'" />
<field name="financial_statements_report_section" eval="'assets'" />
</record>
<record model="account.account.type" id="account.data_account_type_liquidity">
<field name="account_balance_report_section" eval="'assets'" />
<field name="financial_statements_report_section" eval="'assets'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_current_assets"
>
<field name="account_balance_report_section" eval="'assets'" />
<field name="financial_statements_report_section" eval="'assets'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_non_current_assets"
>
<field name="account_balance_report_section" eval="'assets'" />
<field name="financial_statements_report_section" eval="'assets'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_fixed_assets"
>
<field name="account_balance_report_section" eval="'assets'" />
<field name="financial_statements_report_section" eval="'assets'" />
</record>

<!--
Expenses = "Expenses", "Cost of Revenue", "Depreciation"
-->
<record model="account.account.type" id="account.data_account_type_expenses">
<field name="account_balance_report_section" eval="'expenses'" />
<field name="financial_statements_report_section" eval="'expenses'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_direct_costs"
>
<field name="account_balance_report_section" eval="'expenses'" />
<field name="financial_statements_report_section" eval="'expenses'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_depreciation"
>
<field name="account_balance_report_section" eval="'expenses'" />
<field name="financial_statements_report_section" eval="'expenses'" />
</record>

<!--
Incomes = "Income", "Other Income"
-->
<record model="account.account.type" id="account.data_account_type_revenue">
<field name="account_balance_report_section" eval="'incomes'" />
<field name="financial_statements_report_section" eval="'incomes'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_other_income"
>
<field name="account_balance_report_section" eval="'incomes'" />
<field name="financial_statements_report_section" eval="'incomes'" />
</record>

<!--
Liabilities = "Current Year Earnings", "Payable", "Credit Card", "Prepayments",
"Current Liabilities", "Non-current Liabilities", "Equity"
-->
<record model="account.account.type" id="account.data_unaffected_earnings">
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>
<record model="account.account.type" id="account.data_account_type_payable">
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>
<record model="account.account.type" id="account.data_account_type_credit_card">
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>
<record model="account.account.type" id="account.data_account_type_prepayments">
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_current_liabilities"
>
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>
<record
model="account.account.type"
id="account.data_account_type_non_current_liabilities"
>
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>
<record model="account.account.type" id="account.data_account_type_equity">
<field name="account_balance_report_section" eval="'liabilities'" />
<field name="financial_statements_report_section" eval="'liabilities'" />
</record>

</data>
Expand Down
132 changes: 132 additions & 0 deletions l10n_it_financial_statements_report/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Copyright 2023 Simone Rubino - TAKOBI
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade
from openupgradelib.openupgrade import logged_query

from odoo.tools import DotDict

NEW_MODULE_NAME = "l10n_it_financial_statements_report"
OLD_MODULE_NAME = "l10n_it_account_balance_report"

REMOVED_MODELS = [
"report_trial_balance_account",
"account_balance_report_partner",
"account_balance_report_account",
]

RENAMED_MODELS = [
(
"account_balance_report",
"report.l10n_it_financial_statements_report.report",
),
(
"report.l10n_it_a_b_r.account_balance_report_xlsx",
"report.l10n_it_financial_statements_report.report_xlsx",
),
]

RENAMED_FIELDS = [
(
"account.account.type",
"account_account_type",
"account_balance_report_section",
"financial_statements_report_section",
),
]

RENAMED_XMLIDS = [
(
"template_account_balance_report",
"template_financial_statements_report",
),
(
"account_balance_report",
"report",
),
(
"account_balance_report_base",
"financial_statements_report_base",
),
(
"account_balance_report_title",
"financial_statements_report_title",
),
(
"account_balance_report_filters",
"financial_statements_report_filters",
),
(
"account_balance_report_split_columns",
"financial_statements_report_split_columns",
),
(
"account_balance_report_lines_header",
"financial_statements_report_lines_header",
),
(
"account_balance_report_lines",
"financial_statements_report_lines",
),
(
"account_balance_report_partners",
"financial_statements_report_partners",
),
(
"account_balance_report_totals",
"financial_statements_report_totals",
),
]


def remove_models(cr, model_spec):
for name in model_spec:
logged_query(
cr,
"DELETE FROM ir_model WHERE model = %s",
(name,),
)


def migrate_old_module(cr):
remove_models(
cr,
REMOVED_MODELS,
)
openupgrade.rename_models(
cr,
RENAMED_MODELS,
)
openupgrade.rename_fields(
# The method only needs the cursor, not the whole Environment
DotDict(
cr=cr,
),
RENAMED_FIELDS,
# Prevent Environment usage
# whenever it will be implemented.
no_deep=True,
)
full_renamed_xmlids = [
(
".".join((NEW_MODULE_NAME, old_xmlid)),
".".join((NEW_MODULE_NAME, new_xmlid)),
)
for old_xmlid, new_xmlid in RENAMED_XMLIDS
]
openupgrade.rename_xmlids(
cr,
full_renamed_xmlids,
)


def pre_absorb_old_module(cr):
if openupgrade.is_module_installed(cr, OLD_MODULE_NAME):
openupgrade.update_module_names(
cr,
[
(OLD_MODULE_NAME, NEW_MODULE_NAME),
],
merge_modules=True,
)
migrate_old_module(cr)
Loading

0 comments on commit 1194fb2

Please sign in to comment.