-
-
Notifications
You must be signed in to change notification settings - Fork 718
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! address PR reviews, add migration script, tests overhaul
- Loading branch information
Showing
14 changed files
with
543 additions
and
157 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
17 changes: 0 additions & 17 deletions
17
stock_warehouse_calendar_orderpoint/demo/resource_calendar.xml
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
stock_warehouse_calendar_orderpoint/migrations/14.0.1.1.0/post-mig.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,25 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
from odoo.tools.sql import column_exists | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
if column_exists(cr, "stock_warehouse", "orderpoint_on_workday_tmp"): | ||
# Fill ``orderpoint_on_workday_policy`` with a default value where needed, then | ||
# drop the temporary column | ||
cr.execute( | ||
""" | ||
UPDATE stock_warehouse | ||
SET orderpoint_on_workday_policy = 'skip_to_first_workday' | ||
WHERE orderpoint_on_workday_tmp | ||
""" | ||
) | ||
cr.execute( | ||
""" | ||
ALTER TABLE stock_warehouse | ||
DROP COLUMN orderpoint_on_workday_tmp | ||
""" | ||
) |
25 changes: 25 additions & 0 deletions
25
stock_warehouse_calendar_orderpoint/migrations/14.0.1.1.0/pre-mig.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,25 @@ | ||
# Copyright 2024 Camptocamp SA | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
from odoo.tools.sql import column_exists | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
if column_exists(cr, "stock_warehouse", "orderpoint_on_workday"): | ||
# Store ``orderpoint_on_workday`` in a temporary column to be used in the post-mig | ||
# script to set default values for ``orderpoint_on_workday_policy`` | ||
cr.execute( | ||
""" | ||
ALTER TABLE stock_warehouse | ||
ADD COLUMN IF NOT EXISTS orderpoint_on_workday_tmp BOOLEAN DEFAULT false | ||
""" | ||
) | ||
cr.execute( | ||
""" | ||
UPDATE stock_warehouse | ||
SET orderpoint_on_workday_tmp = true | ||
WHERE orderpoint_on_workday | ||
""" | ||
) |
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
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
Oops, something went wrong.