Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Can I import CSV and match database ID

By
Cameron
on 8/12/16, 6:01 AM 266 views

Trying to move data from one db to another vis CSV import

My csv has...

id 1 (name)  "A company"

id 2 (name) "Fred"  (parent_id) "id 1

Can I get openerp to associate  (parent_id) "id 1 with "id1" during an import


Regards


Cameron

0

Cameron

--Cameron--
769
| 6 5 8
United Kingdom
--Cameron--
Cameron
On 8/12/16, 9:53 AM

Yes ish!

I solved this by exporting the data to a csv, replacing id references with actual values


eg

sales_order.parter_id = 322,  - export this to csv you get the id 322 from res_partner, which openerp cannot import/match to partner

Using this SQL

copy
(SELECT so.id, rp.name FROM sale_order so
INNER JOIN res_partner rp ON so.partner_id = rp.id)
TO '/tmp/salesorder.csv' delimiter ',' csv header;


322 is replaced with the name from res_partner, which is easy to import

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/12/16, 6:01 AM
Seen: 266 times
Last updated: 8/12/16, 9:55 AM