-
-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2807 from ForgeFlow/14.0-mig-gamification
[14.0][MIG] gamification
- Loading branch information
Showing
5 changed files
with
84 additions
and
4 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
27 changes: 27 additions & 0 deletions
27
openupgrade_scripts/scripts/gamification/14.0.1.0/post-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,27 @@ | ||
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def create_karma_trackings(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
INSERT INTO gamification_karma_tracking (user_id, old_value, new_value, | ||
tracking_date, create_uid, write_uid, create_date, write_date) | ||
SELECT id, 0, karma, create_date::date, create_uid, write_uid, | ||
create_date, write_date | ||
FROM res_users | ||
WHERE karma IS NOT NULL AND karma != 0""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
create_karma_trackings(env) | ||
openupgrade.load_data(env.cr, "gamification", "14.0.1.0/noupdate_changes.xml") | ||
openupgrade.delete_record_translations( | ||
env.cr, | ||
"gamification", | ||
["email_template_badge_received", "email_template_goal_reminder"], | ||
) |
18 changes: 18 additions & 0 deletions
18
openupgrade_scripts/scripts/gamification/14.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,18 @@ | ||
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.rename_fields( | ||
env, | ||
[ | ||
( | ||
"gamification.challenge", | ||
"gamification_challenge", | ||
"category", | ||
"challenge_category", | ||
) | ||
], | ||
) |
35 changes: 35 additions & 0 deletions
35
openupgrade_scripts/scripts/gamification/14.0.1.0/upgrade_analysis_work.txt
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,35 @@ | ||
---Models in module 'gamification'--- | ||
new model gamification.karma.tracking | ||
# DONE: post-migration: populated | ||
|
||
---Fields in module 'gamification'--- | ||
gamification / gamification.challenge / category (selection) : DEL required, selection_keys: ['hr', 'other'], req_default: function | ||
gamification / gamification.challenge / challenge_category (selection): NEW required, selection_keys: ['hr', 'other'], req_default: function, hasdefault | ||
# DONE: pre-migration: renamed field | ||
|
||
gamification / gamification.karma.rank / karma_min (integer) : now required, req_default: function | ||
# NOTHING TO DO: has default | ||
|
||
gamification / gamification.karma.tracking / consolidated (boolean) : NEW | ||
gamification / gamification.karma.tracking / new_value (integer) : NEW required | ||
gamification / gamification.karma.tracking / old_value (integer) : NEW required | ||
gamification / gamification.karma.tracking / tracking_date (date) : NEW hasdefault | ||
gamification / gamification.karma.tracking / user_id (many2one) : NEW relation: res.users, required | ||
gamification / res.users / karma_tracking_ids (one2many) : NEW relation: gamification.karma.tracking | ||
# DONE: post-migration: created records for each user with karma | ||
|
||
---XML records in module 'gamification'--- | ||
DEL gamification.goal.definition: gamification.definition_nbr_following (noupdate) | ||
NEW ir.actions.act_window: gamification.action_current_rank_users | ||
NEW ir.actions.act_window: gamification.gamification_karma_tracking_action | ||
NEW ir.cron: gamification.ir_cron_consolidate_last_month (noupdate) | ||
NEW ir.model.access: gamification.access_gamification_badge_user_wizard | ||
NEW ir.model.access: gamification.access_gamification_goal_wizard | ||
NEW ir.model.access: gamification.gamification_karma_tracking_access_all | ||
NEW ir.model.access: gamification.gamification_karma_tracking_access_user_manager | ||
NEW ir.ui.menu: gamification.gamification_karma_tracking_menu | ||
NEW ir.ui.view: gamification.gamification_karma_tracking_view_form | ||
NEW ir.ui.view: gamification.gamification_karma_tracking_view_search | ||
NEW ir.ui.view: gamification.gamification_karma_tracking_view_tree | ||
NEW ir.ui.view: gamification.res_users_view_form | ||
# NOTHING TO DO |