-
-
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.
Co-Authored-By: Pedro M. Baeza <[email protected]>
- Loading branch information
1 parent
a087736
commit d536986
Showing
4 changed files
with
83 additions
and
168 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
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 |
---|---|---|
|
@@ -11,33 +11,26 @@ | |
("mail_channel", "discuss_channel"), | ||
("mail_channel_member", "discuss_channel_member"), | ||
("mail_channel_rtc_session", "discuss_channel_rtc_session"), | ||
("mail_channel_res_groups_rel", "discuss_channel_res_groups_rel"), | ||
] | ||
_fields_renames = [ | ||
( | ||
"discuss.channel", | ||
"discuss_channel", | ||
"mail.tracking.value", | ||
"mail_tracking_value", | ||
"field", | ||
"field_id", | ||
), | ||
] | ||
|
||
|
||
def _discuss_channel_fill_allow_public_upload(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE discuss_channel | ||
ADD COLUMN IF NOT EXISTS allow_public_upload BOOLEAN; | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE discuss_channel | ||
SET allow_public_upload = True | ||
WHERE channel_type = 'livechat' | ||
""", | ||
) | ||
_columns_renames = { | ||
"discuss_channel_res_groups_rel": [ | ||
("mail_channel_id", "discuss_channel_id"), | ||
], | ||
} | ||
_columns_copies = { | ||
"mail_template": [ | ||
("report_template", None, None), | ||
], | ||
} | ||
|
||
|
||
def _mail_alias_fill_multiple_values(env): | ||
|
@@ -58,14 +51,9 @@ def _mail_alias_fill_multiple_values(env): | |
env.cr, | ||
""" | ||
UPDATE mail_alias | ||
SET alias_incoming_local = True | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE mail_alias | ||
SET alias_status = 'not_tested' | ||
SET | ||
alias_incoming_local = True, | ||
alias_status = 'valid' | ||
""", | ||
) | ||
|
||
|
@@ -83,6 +71,16 @@ def _mail_tracking_value_update_monetary_tracking_values(env): | |
) | ||
|
||
|
||
def _mail_gateway_allowed(env): | ||
"""Set some dummy value so that the not null constraint can be created""" | ||
env.cr.execute( | ||
""" | ||
UPDATE mail_gateway_allowed SET email='[email protected]' | ||
WHERE email IS NULL | ||
""" | ||
) | ||
|
||
|
||
def _company_update_email_colors(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
|
@@ -113,10 +111,12 @@ def migrate(env, version): | |
openupgrade.rename_models(env.cr, _models_renames) | ||
openupgrade.rename_tables(env.cr, _tables_renames) | ||
openupgrade.rename_fields(env, _fields_renames) | ||
_discuss_channel_fill_allow_public_upload(env) | ||
openupgrade.rename_columns(env.cr, _columns_renames) | ||
openupgrade.copy_columns(env.cr, _columns_copies) | ||
_mail_alias_fill_multiple_values(env) | ||
_mail_tracking_value_update_monetary_tracking_values(env) | ||
_company_update_email_colors(env) | ||
_mail_gateway_allowed(env) | ||
# create column to avoid model mail.alias is loaded before model res.company | ||
openupgrade.logged_query( | ||
env.cr, | ||
|
Oops, something went wrong.