OCA / OpenUpgrade

Open source upgrade path for Odoo/OpenERP
https://oca.github.io/OpenUpgrade/
GNU Affero General Public License v3.0
748 stars 698 forks source link

[15.0]account_payment_order fail on aml.bank_payment_line_id not existing #4684

Closed flotho closed 1 day ago

flotho commented 1 day ago

Module

account_payment_order

Describe the bug

Upgrading to v15 The process failed on https://github.com/OCA/bank-payment/blob/15.0/account_payment_order/migrations/15.0.2.0.0/post-migration.py#L25 The message

aml.bank_payment_line_id doesn't exists
LIGNE 18 :         LEFT JOIN account_move_line aml ON aml.bank_payment_...

I've searched in the v14 and v15 basecode and I didn't find the existence of a field called bank_payment_id on account.move.line

Any advice/tips would be appreciated.

flotho commented 1 day ago

Hum... found there https://github.com/OCA/bank-payment/commit/6d486d8b931ff1fcdb5d4d928c5f72c67ccd2ef6#diff-c44811bc7189570a631438d2dca538756d8ad24b26ced88bfd5df3ab44b74f60R20

flotho commented 1 day ago

and no more avialable there : https://github.com/OCA/bank-payment/blob/15.0/account_payment_order/models/account_move_line.py

flotho commented 1 day ago

ah ah... https://github.com/OCA/bank-payment/commit/e3d9930b04495257adfa26a29f5ef04dc47be470#diff-c44811bc7189570a631438d2dca538756d8ad24b26ced88bfd5df3ab44b74f60L21 so the migration scripts needs to be adapted.

flotho commented 1 day ago

What's the best way to do this ? Do I have to create a new migration folder under https://github.com/OCA/bank-payment/tree/15.0/account_payment_order/migrations/ ?

flotho commented 1 day ago

Hum... Something really weird in this process. First of all, the field has disappeared from v14 since 2022 https://github.com/OCA/bank-payment/commit/b8d818967bc221f1663bf8be99ffa4165f321414#diff-c44811bc7189570a631438d2dca538756d8ad24b26ced88bfd5df3ab44b74f60L21 Yet AFAICR, the field is not deleted from the v14 in the https://github.com/OCA/bank-payment/blob/14.0/account_payment_order/migrations/14.0.2.0.0/post-migration.py And IMHO, the table should be deleted in the v14 to prevent this : https://github.com/OCA/bank-payment/blob/15.0/account_payment_order/migrations/15.0.2.0.0/pre-migration.py#L8 What's your POV @pedrobaeza @alexis-via

pedrobaeza commented 1 day ago

You must have everything totally update in 14 before migrating to 15.

flotho commented 1 day ago

Hum, that's the point, the module is updated BUT the table bank_payment_line still exists at the end of the v14 update and then it raise the issue in v15. That's why I'm wondering if deleting the table at the end of the v14 wouldn't be the proper idea.

Your feedback would be appreciated regards

flotho commented 1 day ago

If you agree with my analysis @pedrobaeza , could we reopen this one ?

pedrobaeza commented 1 day ago

Well, a good habit is to pass database_cleanup before migrating.

flotho commented 1 day ago

Hum... forgot this one Would it be a good idea to have a chapter "before upgrade" like https://oca.github.io/OpenUpgrade/050_after_migration.html to refresh memory to dev like me ;-) ?

pedrobaeza commented 1 day ago

Yeah, you can propose it

flotho commented 19 hours ago

thanks