-
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] purchase_request_analytic: Migration to 17.0
- Loading branch information
1 parent
1829c07
commit 5ddaadf
Showing
9 changed files
with
124 additions
and
100 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
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
15 changes: 15 additions & 0 deletions
15
purchase_request_analytic/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,15 @@ | ||
from odoo.tools.sql import column_exists | ||
|
||
|
||
def migrate(cr, version): | ||
"""Populate analytic distribution values from the old analytic account""" | ||
if column_exists(cr, "purchase_request", "analytic_distribution"): | ||
return | ||
cr.execute( | ||
""" | ||
ALTER TABLE purchase_request ADD COLUMN analytic_distribution jsonb; | ||
update purchase_request set analytic_distribution = | ||
json_build_object(analytic_account_id::varchar, 100.0) | ||
where analytic_account_id is not null; | ||
""" | ||
) |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
This module adds the analytic account field to Purchase Requests. | ||
This module adds an analytic distribution field to Purchase Requests. The field | ||
serves as a default for new lines on a request. |
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,3 @@ | ||
- Assign an analytic account to the purchase request or to purchase | ||
- Assign an analytic distribution to the purchase request or to purchase | ||
request lines. | ||
|
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.