r/Odoo • • 1d ago

MIGRATION DATA BASE

Hey everyone,

I'm trying to migrate data from an existing database to a new one.

I used the standard export/import method (Actions β†’ Export β†’ select fields, etc.), and the data imports successfully. The problem is that the document statuses aren't preserved.

For example, Purchase Orders that were already confirmed and received get imported as RFQs, so I have to confirm them manually again. The same issue happens with Vendor Bills: they get imported as drafts, and I end up having to recreate them manually and relink them to their source documents (POs or SOs).

Is there a way to export/import data while keeping everything exactly as it was in the original database, including document states and links between records?

Any advice would be appreciated. Thanks!
note: im working with odoo 18 to 18 no version update !!!

1 Upvotes

10 comments sorted by

2

u/ach25 1d ago

No those are traditionally system computed fields. The approach would be to statically write the data which I don't think is possible through the export/import with spreadsheets you have to run python scripts over the API or direct db writes. There are also accounting considerations wrapped up with bringing various legacy data over. The links etc. can be repopulated but both the SO and PO need to be imported and reconnected since their respective db ids might have changed.

If you want to mess around with it talk with your favorite AI program on the topic but be alert its a decently heavy concept and that sinkhole an enormous amount of time.

This is why Open POs and SOs are just brought over as the simplest migration. Legacy transactional data is and will always be a pain no matter the ERP flavor.

1

u/catgirl_2006 1d ago

is there any oca than can do that ? except openupgade ig its for version to new version

1

u/ach25 1d ago

No it’s quite complex of a maneuver and since one just needs Python to do it, no need for a module proper.

There was a company a while back that had a sync tool but the same conundrums would still exist with the sync.

1

u/catgirl_2006 1d ago

okaaay so im gonna try using py thank youu

2

u/nikoxr 1d ago

Like ach25 told you it's a big topic to do. Because you might think you are just importing SO and POs, but consider that both would trigger procurement and reserve your stock which is done during the confirmation of the document.

Then Vendor Bills and Invoices would also generate analytic lines used on your general ledger. To properly migrate your data, you would need a python script to run on the shell.

Something like

so = self.env["sale.order"].create(<your so vals>)

if state val == "confirmed":

so.action_confirm()

and same thing for the other documents

1

u/catgirl_2006 1d ago

okay im gonna ask ia to gimme the script and retry ! thank you

1

u/JustSomeOdooGuy 1d ago

Why do you even need to migrate in first place? Because I'd absolutely avoid it if possible. Maybe there is another option?

1

u/TopLychee1081 3h ago

Migration is a technical task. It requires technical knowledge of data modelling and Odoo. It's absolutely not a user task.