[17.0][OU-ADD] base_automation: migration to 17.0#4459
[17.0][OU-ADD] base_automation: migration to 17.0#4459daiduongnguyen-odoo wants to merge 1 commit into
Conversation
|
/ocabot migration base_automation |
049f0c9 to
2451dd0
Compare
| .search([("base_automation_id", "!=", False)]) | ||
| ) | ||
| if act_servers: | ||
| act_servers._compute_name() |
There was a problem hiding this comment.
It is possible that certain models are not yet loaded in the migration and that an error occurs when executing this point.
2024-10-08 08:35:05,839 1 ERROR database OpenUpgrade: base_automation: error in migration script /opt/odoo/auto/addons/openupgrade_scripts/scripts/base_automation/17.0.1.0/post-migration.py: 'project.task'
2024-10-08 08:35:05,844 1 ERROR database OpenUpgrade: 'project.task'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/openupgradelib/openupgrade.py", line 2298, in wrapped_function
func(
File "/opt/odoo/auto/addons/openupgrade_scripts/scripts/base_automation/17.0.1.0/post-migration.py", line 75, in migrate
_ir_act_server_update_name_if_base_automation(env)
File "/opt/odoo/auto/addons/openupgrade_scripts/scripts/base_automation/17.0.1.0/post-migration.py", line 13, in _ir_act_server_update_name_if_base_automation
act_servers._compute_name()
File "/opt/odoo/auto/addons/base_automation/models/ir_actions_server.py", line 47, in _compute_name
action.name = f"{action_type} {action._stringify_path()}"
File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/ir_actions.py", line 679, in _stringify_path
model = self.env[self.model_id.model]
File "/opt/odoo/auto/addons/openupgrade_framework/odoo_patch/odoo/api.py", line 39, in __getitem__
return Environment.__getitem__._original_method(self, model_name)
File "/opt/odoo/custom/src/odoo/odoo/api.py", line 534, in __getitem__
return self.registry[model_name](self, (), ())
File "/opt/odoo/custom/src/odoo/odoo/modules/registry.py", line 213, in __getitem__
return self.models[model_name]
KeyError: 'project.task'
Maybe move this part to an end-migrate.py?
There was a problem hiding this comment.
Yes, it can be move to end-migrate.
Unfortunately i'm no longer doing migration anymore, at least until next year. Feel free to cherry-pick my commit and create you own if you have to
There was a problem hiding this comment.
And this is not doing it for every language AFAIK.
| ADD COLUMN IF NOT EXISTS base_automation_id INTEGER; | ||
| """, | ||
| ) | ||
| openupgrade.logged_query( |
There was a problem hiding this comment.
I think we should make us of m2o_to_x2m() openupgradelib method
flotho
left a comment
There was a problem hiding this comment.
Tested and solved some upgrade issues
LGTM
| base_automation / base.automation / description (html) : NEW | ||
| base_automation / base.automation / log_webhook_calls (boolean) : NEW hasdefault: default | ||
| base_automation / base.automation / record_getter (char) : NEW hasdefault: default | ||
| base_automation / base.automation / webhook_uuid (char) : NEW |
There was a problem hiding this comment.
This one should be initialized one by one for not getting all the records the same UUID.
| ADD COLUMN IF NOT EXISTS base_automation_id INTEGER; | ||
| """, | ||
| ) | ||
| openupgrade.logged_query( |
|
|
||
| base_automation / base.automation / trg_field_ref (many2one_reference): NEW relation: trg_field_ref_model_name, hasdefault: compute | ||
| base_automation / base.automation / trg_selection_field_id (many2one): NEW relation: ir.model.fields.selection, hasdefault: compute | ||
| # NOTHING TO DO: new feature |
There was a problem hiding this comment.
You should pre-create the columns for avoiding to trigger the compute method.
| # NOTHING TO DO: new feature | ||
|
|
||
| base_automation / base.automation / trigger (selection) : selection_keys is now '['on_archive', 'on_change', 'on_create', 'on_create_or_write', 'on_message_received', 'on_message_sent', 'on_priority_set', 'on_stage_set', 'on_state_set', 'on_tag_set', 'on_time', 'on_time_created', 'on_time_updated', 'on_unarchive', 'on_unlink', 'on_user_set', 'on_webhook', 'on_write']' ('['on_change', 'on_create', 'on_create_or_write', 'on_time', 'on_unlink', 'on_write']') | ||
| # DONE post-migration: set 'on_create' and 'on_write' by 'on_create_or_write' |
There was a problem hiding this comment.
Although deprecated, they still works, so I think it's not the time to change them.
| .search([("base_automation_id", "!=", False)]) | ||
| ) | ||
| if act_servers: | ||
| act_servers._compute_name() |
There was a problem hiding this comment.
And this is not doing it for every language AFAIK.
|
Superseded by #5028. |
No description provided.