Skip to content

[ADD] Additions to the base migration#2210

Merged
OCA-git-bot merged 2 commits intoOCA:13.0from
StefanRijnhart:imp/13.0/base
Mar 8, 2020
Merged

[ADD] Additions to the base migration#2210
OCA-git-bot merged 2 commits intoOCA:13.0from
StefanRijnhart:imp/13.0/base

Conversation

@StefanRijnhart
Copy link
Member

No description provided.

@kos94ok-3D
Copy link

Hi, @StefanRijnhart .
I forgot to rename a field in my PR

_field_renames = [
    ('ir.server.object.lines', 'ir_server_object_lines', 'type', 'evaluation_type'),
]
openupgrade.rename_fields(env, _field_renames)
=======================================================================
base         / ir.server.object.lines   / evaluation_type (selection)   : NEW required, selection_keys: ['equation', 'reference', 'value'], req_default: function, hasdefault
base         / ir.server.object.lines   / type (selection)              : DEL required, selection_keys: ['equation', 'reference', 'value'], req_default: function

Please add it in your one.
And what do you think about add it in post-migration:

def fix_binding_fields(env):
    """
    Adapt binding_type and binding_view_types fields values.
    Useful for manually created actions.
    """
    model_name_lists = [
        'ir.actions.act_url',
        'ir.actions.act_window',
        'ir.actions.act_window_close',
        'ir.actions.actions',
        'ir.actions.client',
        'ir.actions.report',
        'ir.actions.server',
    ]
    for model_name in model_name_lists:
        records = env[model_name].search([('binding_type', '=', 'action_form_only')])
        vals = {
            'binding_type': 'action',
            'binding_view_types': "'form'",
        }
        records.write(vals)

@StefanRijnhart
Copy link
Member Author

Field renamed, thanks. I don't see action_form_only used anywhere in Odoo 12. What should it have been used for?

@StefanRijnhart
Copy link
Member Author

Ah, I see someting in convert.py. Will have a look

@StefanRijnhart
Copy link
Member Author

'action_form_only' now migrated correctly. Odoo happens to use table inheritance here (and only here, I believe), see https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/data/base_data.sql#L9-L13. Therefore, we just have to adjust a single table.

Thanks, that was a good catch!

Copy link

@kos94ok-3D kos94ok-3D left a comment

Choose a reason for hiding this comment

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

rename_fields or rename_columns

Comment on lines 475 to 477
Copy link

@kos94ok-3D kos94ok-3D Mar 3, 2020

Choose a reason for hiding this comment

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

I think better use openupgrade.rename_fields than openupgrade.rename_columns in order to keep translation

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed! Code adapted. I also removed the use_env=True argument to the migrate decorator as it has been the default for some time now.

Copy link

@kos94ok-3D kos94ok-3D left a comment

Choose a reason for hiding this comment

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

Code review and functionality test.
Thank you for a great job.

@StefanRijnhart
Copy link
Member Author

Thank you for the review!

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks. Code review. No test.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@legalsylvain
Copy link
Contributor

/ocabot merge

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 13.0-ocabot-merge-pr-2210-by-legalsylvain-bump-no, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 91593a5 into OCA:13.0 Mar 8, 2020
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 91593a5. Thanks a lot for contributing to OCA. ❤️

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.

4 participants