-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
[17.0][OU-ADD] payment: Migration scripts #4584
Conversation
for reference, the 5 key commits for v17: https://github.com/akretion/odoo-module-diff-analysis/tree/main/17.0/payment |
d7cf356
to
0944bd0
Compare
Remove payment.payment_method_acss_debit as does not exist anymore Move payment.icon to payment.method Reload payment methods and links to providers
0944bd0
to
39973e6
Compare
Thanks @rvalyi it helps understanding where the changes come from (although in that case many changes were on data so there are more commits to take into account). |
/ocabot migration payment |
This comment was marked as outdated.
This comment was marked as outdated.
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.
Totally agree with renaming payment.icon
to payment.method
, as that will be the base for whatever migrations of modules depending on payment
do.
Not so sure yet about the full reload of the payment methods, shouldn't we only force load new fields like primary_payment_method_id
? Or the other way around, not touch active
and sequence
?
for payment_token in PaymentToken.search([("payment_method_id", "=", False)]): | ||
payment_token.payment_method_id = ( | ||
PaymentMethod._get_from_code(payment_token.provider_id.code) | ||
or unknown_payment_method | ||
).id | ||
|
||
for transaction in PaymentTransaction.search([("payment_method_id", "=", False)]): | ||
transaction.payment_method_id = ( | ||
PaymentMethod._get_from_code(transaction.provider_id.code) | ||
or unknown_payment_method | ||
).id |
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.
can we group those by provider_id and do only one write per provider?
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.
"payment_provider", | ||
"payment_icon_ids", | ||
"payment_method_ids", | ||
), |
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.
for this to work we'll also have to rename payment_icon_payment_provider_rel
I think, and in there payment_icon_id
to payment_method_id
(I wonder if we should actually add this to rename_fields, seems a common enough task)
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.
You are right of course, however since link between provider and methods completely changed in v17, I thought that maybe it was better to let ORM recreate the full table.
Now I see that you may have extra payment provider (not provided by Odoo) that would need to keep their corresponding methods, so it makes sense to migrate those as you did in 4ec754c
@remi-filament I've implemented my suggestions in #4692 |
The problem here is that before you only had 3 fields in data : sequence, name, image (https://github.com/odoo/odoo/blob/16.0/addons/payment/data/payment_icon_data.xml) Note that active and primary_payment_method_id did not exist before in v16. Therefore I believe there were 2 ways to handle this :
|
Take over payment migration from PR #4466 upon @duong77476-viindoo request (#4466 (comment))
Extra tasks performed :