-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] update_module_moved_models #281
[ADD] update_module_moved_models #281
Conversation
This should be done in openupgradelib/openupgradelib/openupgrade.py Line 2532 in c03d029
|
Not exactly, because that method is used only for fields, not models. One could do a new one, like in #249, but I thought it's easier to just reuse
The odoo framework doesn't do renames per se. It only deletes "wrong data" and creates new data. Obviously, it will not delete translations that have wrong module after a model rename. About OU framework, I don't know if it can be readapted, but I don't want to consume more time to check it. |
I think then it should be a different method, as you can have a module rename, but not a model rename. |
f288ad4
to
0013ccc
Compare
@pedrobaeza Ready |
@kaerdsar FYI |
) | ||
underscore = "_" if version_info[0] < 12 else "__" | ||
logged_query( | ||
cr, """UPDATE ir_model_data imd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled by framework, so I don't think this should be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OU framework only is used in migrations. But if you are not in OU, but in production, and do an update of two modules that contains a refactor between them, and you want to use this method, then what? Let's be sure this method handle everything neatly just in case (it will be used in very few places) independently of the OU framework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not talking about OU framework, but ORM framework. It's handled automatically since 12.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But ORM framework doesn't do data updates, only deletes wrong data and creates new data for the non-existing ones. Yeah, we could let ORM do this, but it's ugly. I prefer update the data by query and avoid the later ORM process of delete + create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the affected model has noupdate records? then the ORM won't update them!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a real case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We faced it lately (mail templates in noupdate + translations done directly in the DB), having such method to move all of this from one addon to another would have saved us time for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On some projects we used a small helper that is similar to this this one.
We did not had the time to add it to openupgradelib.
0013ccc
to
a22c92b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it useful
Avoid cases like:
