Compare commits
merge into: njeudy:12.0
njeudy:11.0
njeudy:12.0
njeudy:12.0-add-financial-risk
njeudy:12.0-backend_filter
njeudy:12.0-chg-monetary_fields
njeudy:12.0-easy_my_coop-module_category_cooperator_management
njeudy:12.0-emc-rest-connector
njeudy:12.0-emc_loan-o3-add-paid-amount
njeudy:12.0-emc_loan-o6-subscription_end_date
njeudy:12.0-fix-coop-validation
njeudy:12.0-flag-easymycoop-mail-template
njeudy:12.0-loan-improvements
njeudy:12.0-max-amount-per-share
njeudy:12.0-o4-net-interest-rate
njeudy:12.0-openupgrade
njeudy:12.0-small-changes
njeudy:12.0-touch-cooperator-type
njeudy:14.0-MIG-INITIAL
njeudy:9.0
njeudy:9.0-fix_tax_shelter_declaration_exclusion
njeudy:9.0-medor-hide_bank_and_birthdate
njeudy:9.0-tag
njeudy:9.0_remove_national_register_number
njeudy:myceliandre_usability
pull from: njeudy:12.0-openupgrade
njeudy:11.0
njeudy:12.0
njeudy:12.0-add-financial-risk
njeudy:12.0-backend_filter
njeudy:12.0-chg-monetary_fields
njeudy:12.0-easy_my_coop-module_category_cooperator_management
njeudy:12.0-emc-rest-connector
njeudy:12.0-emc_loan-o3-add-paid-amount
njeudy:12.0-emc_loan-o6-subscription_end_date
njeudy:12.0-fix-coop-validation
njeudy:12.0-flag-easymycoop-mail-template
njeudy:12.0-loan-improvements
njeudy:12.0-max-amount-per-share
njeudy:12.0-o4-net-interest-rate
njeudy:12.0-openupgrade
njeudy:12.0-small-changes
njeudy:12.0-touch-cooperator-type
njeudy:14.0-MIG-INITIAL
njeudy:9.0
njeudy:9.0-fix_tax_shelter_declaration_exclusion
njeudy:9.0-medor-hide_bank_and_birthdate
njeudy:9.0-tag
njeudy:9.0_remove_national_register_number
njeudy:myceliandre_usability
3 Commits
12.0
...
12.0-openu
Author | SHA1 | Message | Date |
---|---|---|---|
Vincent Van Rossem | 783c3e331d |
[WIP] easy_my_coop: migration script
|
4 years ago |
Vincent Van Rossem | c659932ade |
[ADD] website_recaptcha_reloaded: pre-migration.py
|
5 years ago |
Vincent Van Rossem | fc19fb41aa |
[ADD] easy_my_coop: openupgrade.rename_xmlids()
|
5 years ago |
3 changed files with 137 additions and 0 deletions
-
42easy_my_coop/migrations/12.0.3.0.1/post-migration.py
-
82easy_my_coop/migrations/12.0.3.0.1/pre-migration.py
-
13website_recaptcha_reloaded/migrations/12.0.0.0.1/pre-migration.py
@ -0,0 +1,42 @@ |
|||||
|
from openupgradelib import openupgrade |
||||
|
|
||||
|
|
||||
|
def update_records_module_category_cooperator_management(env): |
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
UPDATE |
||||
|
res_groups_users_rel_module_category_cooperator_management |
||||
|
SET gid = ( |
||||
|
SELECT id |
||||
|
FROM res_groups |
||||
|
WHERE name = 'User' |
||||
|
AND category_id = ( |
||||
|
SELECT id |
||||
|
FROM ir_module_category |
||||
|
WHERE name = 'Cooperative Management' |
||||
|
) |
||||
|
);""", |
||||
|
) |
||||
|
|
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
INSERT INTO res_groups_users_rel (gid, uid) |
||||
|
SELECT gid, uid FROM res_groups_users_rel_module_category_cooperator_management |
||||
|
ON CONFLICT DO NOTHING;""", |
||||
|
) |
||||
|
|
||||
|
|
||||
|
def drop_records_module_category_cooperator_management(env): |
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
DROP TABLE res_groups_users_rel_module_category_cooperator_management;""", |
||||
|
) |
||||
|
|
||||
|
|
||||
|
@openupgrade.migrate() |
||||
|
def migrate(env, version): |
||||
|
update_records_module_category_cooperator_management(env) |
||||
|
drop_records_module_category_cooperator_management(env) |
@ -0,0 +1,82 @@ |
|||||
|
from openupgradelib import openupgrade |
||||
|
|
||||
|
xmlid_renames = [ |
||||
|
( |
||||
|
"easy_my_coop.group_energiris_user", |
||||
|
"easy_my_coop.group_easy_my_coop_user", |
||||
|
), |
||||
|
( |
||||
|
"easy_my_coop.group_energiris_manager", |
||||
|
"easy_my_coop.group_easy_my_coop_manager", |
||||
|
), |
||||
|
] |
||||
|
|
||||
|
|
||||
|
def copy_records_module_category_cooperator_management(env): |
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
CREATE TABLE res_groups_users_rel_module_category_cooperator_management AS |
||||
|
SELECT gid, uid |
||||
|
FROM res_groups_users_rel |
||||
|
WHERE gid = ( |
||||
|
SELECT id |
||||
|
FROM res_groups |
||||
|
WHERE name = 'User' |
||||
|
AND category_id = ( |
||||
|
SELECT id |
||||
|
FROM ir_module_category |
||||
|
WHERE name = 'EasyMy Coop' |
||||
|
) |
||||
|
) |
||||
|
ORDER BY gid,uid;""", |
||||
|
) |
||||
|
|
||||
|
|
||||
|
def delete_records_module_category_cooperator_management(env): |
||||
|
""""Since XML-ID module_category_cooperator_management is now flagged as noupdate="1", |
||||
|
we need to manually delete it as well as other records that are linked to it |
||||
|
""" |
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
DELETE |
||||
|
FROM res_groups_users_rel |
||||
|
WHERE gid = ( |
||||
|
SELECT id |
||||
|
FROM res_groups |
||||
|
WHERE name = 'User' |
||||
|
AND category_id = ( |
||||
|
SELECT id |
||||
|
FROM ir_module_category |
||||
|
WHERE name = 'EasyMy Coop' |
||||
|
) |
||||
|
);""", |
||||
|
) |
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
DELETE |
||||
|
FROM res_groups |
||||
|
WHERE name = 'User' |
||||
|
AND category_id = ( |
||||
|
SELECT id |
||||
|
FROM ir_module_category |
||||
|
WHERE name = 'EasyMy Coop' |
||||
|
);""", |
||||
|
) |
||||
|
openupgrade.logged_query( |
||||
|
env.cr, |
||||
|
""" |
||||
|
DELETE |
||||
|
FROM ir_module_category |
||||
|
WHERE name = 'EasyMy Coop';""", |
||||
|
) |
||||
|
|
||||
|
|
||||
|
@openupgrade.migrate() |
||||
|
def migrate(env, version): |
||||
|
cr = env.cr |
||||
|
openupgrade.rename_xmlids(cr, xmlid_renames) |
||||
|
copy_records_module_category_cooperator_management(env) |
||||
|
delete_records_module_category_cooperator_management(env) |
@ -0,0 +1,13 @@ |
|||||
|
from openupgradelib import openupgrade |
||||
|
|
||||
|
_field_renames = [ |
||||
|
("website", "website", "recaptcha_site_key", "recaptcha_key_site"), |
||||
|
("website", "website", "recaptcha_private_key", "recaptcha_key_secret"), |
||||
|
("res.config.settings", "res_config_settings", "recaptcha_site_key", "recaptcha_key_site"), |
||||
|
("res.config.settings", "res_config_settings", "recaptcha_private_key", "recaptcha_key_secret"), |
||||
|
] |
||||
|
|
||||
|
|
||||
|
@openupgrade.migrate() |
||||
|
def migrate(env, version): |
||||
|
openupgrade.rename_fields(env, _field_renames) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue