-
-
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
11 changed files
with
154 additions
and
72 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 |
---|---|---|
|
@@ -14,14 +14,14 @@ 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/webui/builds.html?repo=OCA/account-closing&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
|
@@ -104,7 +104,7 @@ 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**>`_. | ||
`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 +126,7 @@ Contributors | |
* `CorporateHub <https://corporatehub.eu/>`__ | ||
|
||
* Alexey Pelykh <[email protected]> | ||
* Giuseppe Borruso <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
@@ -140,6 +141,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
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 Akretion France (http://www.akretion.com/) | ||
# @author: Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def update_account_type(env, model, new_type, old_type): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE %(model)s | ||
SET account_type = '%(new_type)s' | ||
WHERE id in ( | ||
SELECT id | ||
WHERE account_type_id = '%(old_type)s' | ||
) | ||
""" | ||
% { | ||
"model": model, | ||
"new_type": new_type, | ||
"old_type": old_type, | ||
}, | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
|
||
all_account_type = [ | ||
("asset_receivable", env("account.data_account_type_receivable").id), | ||
("asset_cash", env("account.data_account_type_liquidity").id), | ||
("asset_current", env("account.data_account_type_current_assets").id), | ||
("asset_non_current", env("account.data_account_type_non_current_assets").id), | ||
("asset_fixed", env("account.data_account_type_fixed_assets").id), | ||
("expense", env("account.data_account_type_expenses").id), | ||
("expense_depreciation", env("account.data_account_type_depreciation").id), | ||
("expense_direct_cost", env("account.data_account_type_direct_costs").id), | ||
("off_balance", env("account.data_account_off_sheet").id), | ||
("liability_payable", env("account.data_account_type_payable").id), | ||
("liability_credit_card", env("account.data_account_type_credit_card").id), | ||
("asset_prepayments", env("account.data_account_type_prepayments").id), | ||
("liability_current", env("account.data_account_type_current_liabilities").id), | ||
( | ||
"liability_non_current", | ||
env("account.data_account_type_non_current_liabilities").id, | ||
), | ||
("equity", env("account.data_account_type_equity").id), | ||
("equity_unaffected", env("account.data_unaffected_earnings").id), | ||
("income", env("account.data_account_type_revenue").id), | ||
("income_other", env("account.data_account_type_other_income").id), | ||
] | ||
|
||
for new_type, old_type in all_account_type: | ||
update_account_type( | ||
env, "account_fiscalyear_closing_type_template", new_type, old_type | ||
) | ||
update_account_type(env, "account_fiscalyear_closing_type", new_type, old_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.