-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
[15.0][OU-ADD] commission: Migration scripts #426
[15.0][OU-ADD] commission: Migration scripts #426
Conversation
Hi @pedrobaeza, |
This should be tagged as |
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 rest is OK and no more changes detected by my side.
What about the change of agent_line into settlement_line_ids?: https://github.com/OCA/commission/pull/387/files/b9bc5b033c3d29a9c03b303917ae4945754e9a7b..359c1c13e294456ebf1ebb90c2b668f843d0c038#diff-c9164979c9473b61249db43c11ccb7ec045fee4e548c0f327dc636a8d161a15dR164 |
It's a one2many, so no schema changed. You can call though to |
ddd349e
to
e29bfa6
Compare
But it was a m2m before |
OK, then you must convert the other part of the inverse name. Or is it already there in previous version? |
It isn't there in the previous version, but it seems a bit complicated logistically to not either lose data or break it. env.cr.execute("""
SELECT DISTINCT ON (agent_line_id), settlement_id
FROM settlement_agent_line_rel
ORDER BY agent_line_id
""")
for agent_line_id, settlement_id in env.cr.fetchall():
env["commission.settlement.line"].browse(settlement_id).invoice_agent_line_id = agent_line_id This should work, but I don't have a db to migrate to test it atm |
e29bfa6
to
6897b81
Compare
Thanks. Take a look on post-migration for a performant version of your proposal :) |
Looks good! Looking to try it out soon but I was thinking, wouldn't these scripts need to be in hooks rather than migration scripts? For instance a new database that is migrating from 14 to 15 I imagine gets to the point where it updates I think it should be a hooks with a |
OpenUpgrade runs the migration scripts also for newly installed modules. Hooks are designed for other purposes and can't have things like version discrimination. |
Ah I didn't know OU did some magic there, I was thinking of normal upgrading. No problem then |
I just run it in a customer test migrations and it looks good :) |
6897b81
to
2619d22
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 have added a missing piece for the computed stored commission_id field in commission.settlement.line.
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.
Worked for us too
cc @Tecnativa TT43411