OCA / openupgradelib

A library with support functions to be called from Odoo migration scripts.
GNU Affero General Public License v3.0
85 stars 171 forks source link

Implement m2m_to_o2m #343

Open carmenbianca opened 1 year ago

carmenbianca commented 1 year ago

Ported over from https://github.com/OCA/OpenUpgrade/pull/3911 in the hope that it can be more broadly useful.

Tagging @remytms

carmenbianca commented 1 year ago

I pushed some additional work. Specifically:

I want to see if I can create a strategy that will copy records to prevent data loss.

carmenbianca commented 1 year ago

Ready for review again. Changes since last update:

The copy strategy uses the Odoo ORM (copy()). I don't know if this is good/kosher/permissible. Doing this manually in SQL seemed like a Really Bad Idea™ to me.

carmenbianca commented 1 year ago

Oof, syntax error because Travis uses Python 3.6.

edit: ImportError because Travis uses Python 3.6 :'(

legalsylvain commented 1 year ago

Oof, syntax error because Travis uses Python 3.6. edit: ImportError because Travis uses Python 3.6 :'(

We have to switch to github actions, but not done until now (#322)...

carmenbianca commented 1 year ago

Turns out Python 2 was the problem, not Python 3.6. I added a backport dependency, but it wouldn't be very difficult to get rid of the Enum and use something more primitive.

edit: the backport is incomplete, ugh. I'll fix this someday soon.