-
-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] hr_fleet: add pre-migration to create value for compute field with
store=true by sql instead of auto orm
- Loading branch information
1 parent
1b32e71
commit bf17251
Showing
3 changed files
with
28 additions
and
2 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
26 changes: 26 additions & 0 deletions
26
openupgrade_scripts/scripts/hr_fleet/16.0.1.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,26 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def create_drive_employee(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE fleet_vehicle_assignation_log | ||
ADD IF NOT EXISTS driver_employee_id INT | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE fleet_vehicle_assignation_log AS fval | ||
SET driver_employee_id = fv.driver_employee_id | ||
FROM fleet_vehicle AS fv | ||
WHERE fval.vehicle_id = fv.id | ||
""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
create_drive_employee(env) |
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