Skip to content

[17.0][OU-ADD] base_automation: migration to 17.0#4459

Closed
daiduongnguyen-odoo wants to merge 1 commit into
OCA:17.0from
daiduongnguyen-odoo:v17_ou_add_base_automation
Closed

[17.0][OU-ADD] base_automation: migration to 17.0#4459
daiduongnguyen-odoo wants to merge 1 commit into
OCA:17.0from
daiduongnguyen-odoo:v17_ou_add_base_automation

Conversation

@daiduongnguyen-odoo

Copy link
Copy Markdown
Contributor

No description provided.

@pedrobaeza

pedrobaeza commented Jun 13, 2024

Copy link
Copy Markdown
Member

/ocabot migration base_automation

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jun 13, 2024
@daiduongnguyen-odoo daiduongnguyen-odoo force-pushed the v17_ou_add_base_automation branch from 049f0c9 to 2451dd0 Compare June 13, 2024 06:42
.search([("base_automation_id", "!=", False)])
)
if act_servers:
act_servers._compute_name()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is not doing it for every language AFAIK.

ADD COLUMN IF NOT EXISTS base_automation_id INTEGER;
""",
)
openupgrade.logged_query(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make us of m2o_to_x2m() openupgradelib method

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

@flotho flotho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.


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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is not doing it for every language AFAIK.

@MiquelRForgeFlow

Copy link
Copy Markdown
Contributor

Superseded by #5028.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants