-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] account_analytic_required: make field non-company-dependant
The model `account.account` is already company-dependant by itself. Thus, adding a company-dependant field makes no sense. @moduon MT-7319
- Loading branch information
Showing
8 changed files
with
43 additions
and
11 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 |
---|---|---|
|
@@ -29,7 +29,7 @@ Account Analytic Required | |
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds an option *analytic policy* on accounts. | ||
You have the choice between 4 policies : *always*, *never*, *posted moves* and *optional*. | ||
You have the choice between 4 policies : *always*, *never*, *posted moves* and empty (*optional*). | ||
|
||
**Table of contents** | ||
|
||
|
@@ -79,6 +79,7 @@ Contributors | |
* `Trobz <https://trobz.com>`_: | ||
|
||
* Nguyễn Minh Chiến <[email protected]> | ||
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__) | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
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
32 changes: 32 additions & 0 deletions
32
account_analytic_required/migrations/16.0.2.0.0/post-migrate.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,32 @@ | ||
# Copyright 2024 Moduon Team S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) | ||
"""Convert company-dependant field to normal.""" | ||
|
||
|
||
def migrate(cr, version): | ||
cr.execute( | ||
r""" | ||
UPDATE account_account AS acc | ||
SET analytic_policy = prop.value_text | ||
FROM ( | ||
SELECT | ||
substring(res_id FROM '\d+')::int AS account_id, | ||
value_text | ||
FROM ir_property | ||
WHERE | ||
name = 'analytic_policy' | ||
AND res_id LIKE 'account.account,%' | ||
AND value_text != 'optional' | ||
) AS prop | ||
WHERE | ||
acc.id = prop.account_id | ||
""" | ||
) | ||
cr.execute( | ||
""" | ||
DELETE FROM ir_property | ||
WHERE | ||
name = 'analytic_policy' | ||
AND res_id LIKE 'account.account,%' | ||
""" | ||
) |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
* `Trobz <https://trobz.com>`_: | ||
|
||
* Nguyễn Minh Chiến <[email protected]> | ||
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__) |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
This module adds an option *analytic policy* on accounts. | ||
You have the choice between 4 policies : *always*, *never*, *posted moves* and *optional*. | ||
You have the choice between 4 policies : *always*, *never*, *posted moves* and empty (*optional*). |
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