-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] account_fiscal_year_closing: Migration to 16.0
- Loading branch information
Showing
14 changed files
with
311 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,13 @@ | |
Fiscal year closing | ||
=================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:4127392bb324718841b4c7a5e89af6dc051892f5a1711b5846ea44c04bc5dddc | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
|
@@ -14,16 +17,16 @@ Fiscal year closing | |
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--closing-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-closing/tree/14.0/account_fiscal_year_closing | ||
:target: https://github.com/OCA/account-closing/tree/16.0/account_fiscal_year_closing | ||
:alt: OCA/account-closing | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-closing-14-0/account-closing-14-0-account_fiscal_year_closing | ||
:target: https://translation.odoo-community.org/projects/account-closing-16-0/account-closing-16-0-account_fiscal_year_closing | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/89/14.0 | ||
:alt: Try me on Runbot | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-closing&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module implements a generic fiscal year closing system for those | ||
countries where closing/opening moves or other kind of closing operations are | ||
|
@@ -103,8 +106,8 @@ Bug Tracker | |
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-closing/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/account-closing/issues/new?body=module:%20account_fiscal_year_closing%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-closing/issues/new?body=module:%20account_fiscal_year_closing%0Aversion:%2016.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. | ||
|
||
|
@@ -126,6 +129,7 @@ Contributors | |
* `CorporateHub <https://corporatehub.eu/>`__ | ||
|
||
* Alexey Pelykh <[email protected]> | ||
* Giuseppe Borruso <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
@@ -140,6 +144,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/account-closing <https://github.com/OCA/account-closing/tree/14.0/account_fiscal_year_closing>`_ project on GitHub. | ||
This module is part of the `OCA/account-closing <https://github.com/OCA/account-closing/tree/16.0/account_fiscal_year_closing>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
account_fiscal_year_closing/migrations/16.0.1.0.0/noupdate_changes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="fiscalyear_closing_multi_company_rule" model="ir.rule"> | ||
<field | ||
name="domain_force" | ||
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> | ||
</record> | ||
|
||
<record id="fiscalyear_closing_template_multi_company_rule" model="ir.rule"> | ||
<field | ||
name="domain_force" | ||
>['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> | ||
</record> | ||
|
||
</odoo> |
15 changes: 15 additions & 0 deletions
15
account_fiscal_year_closing/migrations/16.0.1.0.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2023 Giuseppe Borruso <[email protected]> | ||
# @author: Giuseppe Borruso <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
|
||
openupgrade.load_data( | ||
env.cr, | ||
"account_fiscal_year_closing", | ||
"migrations/16.0.1.0.0/noupdate_changes.xml", | ||
) |
58 changes: 58 additions & 0 deletions
58
account_fiscal_year_closing/migrations/16.0.1.0.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright 2023 Giuseppe Borruso <[email protected]> | ||
# @author: Giuseppe Borruso <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def update_account_type(env, table): | ||
openupgrade.logged_query( | ||
env.cr, | ||
f""" | ||
ALTER TABLE {table} | ||
ADD COLUMN IF NOT EXISTS account_type VARCHAR | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
f""" | ||
WITH account_type_map AS ( | ||
SELECT | ||
res_id AS user_type_id, | ||
CASE | ||
WHEN name = 'data_account_type_receivable' THEN 'asset_receivable' | ||
WHEN name = 'data_account_type_liquidity' THEN 'asset_cash' | ||
WHEN name = 'data_account_type_current_assets' THEN 'asset_current' | ||
WHEN name = 'data_account_type_non_current_assets' THEN 'asset_non_current' | ||
WHEN name = 'data_account_type_fixed_assets' THEN 'asset_fixed' | ||
WHEN name = 'data_account_type_expenses' THEN 'expense' | ||
WHEN name = 'data_account_type_depreciation' THEN 'expense_depreciation' | ||
WHEN name = 'data_account_type_direct_costs' THEN 'expense_direct_cost' | ||
WHEN name = 'data_account_off_sheet' THEN 'off_balance' | ||
WHEN name = 'data_account_type_payable' THEN 'liability_payable' | ||
WHEN name = 'data_account_type_credit_card' THEN 'liability_credit_card' | ||
WHEN name = 'data_account_type_prepayments' THEN 'asset_prepayments' | ||
WHEN name = 'data_account_type_current_liabilities' THEN 'liability_current' | ||
WHEN name = 'data_account_type_non_current_liabilities' THEN 'liability_non_current' | ||
WHEN name = 'data_account_type_equity' THEN 'equity' | ||
WHEN name = 'data_unaffected_earnings' THEN 'equity_unaffected' | ||
WHEN name = 'data_account_type_revenue' THEN 'income' | ||
WHEN name = 'data_account_type_other_income' THEN 'income_other' | ||
ELSE '' | ||
END AS account_type | ||
FROM ir_model_data | ||
WHERE module = 'account' AND model = 'account.account.type' | ||
) | ||
UPDATE {table} aa | ||
SET account_type = atm.account_type | ||
FROM account_type_map atm | ||
WHERE atm.user_type_id = aa.user_type_id | ||
""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
|
||
update_account_type(env, "account_fiscalyear_closing_type_template") | ||
update_account_type(env, "account_fiscalyear_closing_type") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
* `CorporateHub <https://corporatehub.eu/>`__ | ||
|
||
* Alexey Pelykh <[email protected]> | ||
* Giuseppe Borruso <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.