Reputation: 253
Task is to move data (partners and so on) from 7 to 10 vesrion. What I do is moving tables from 7 to 10 database and next do like this:
INSERT INTO res_partner (id, active, barcode, city, color, comment, commercial_company_name, commercial_partner_id, company_id, company_name, country_id, create_date, create_uid, credit_limit, customer, date, debit_limit, display_name, email, employee, fax, function, invoice_warn_msg, invoice_warn, is_company, lang, last_time_entries_checked, message_bounce, message_last_post, mobile, name, notify_email, opt_out, parent_id, partner_share, phone, ref, sale_warn_msg, sale_warn, signup_expiration, signup_token, signup_type, state_id, street, street2, supplier, team_id, title, type, tz, user_id, vat, website, write_date, write_uid, zip)
SELECT id, active, '' AS barcode, city, color, comment, name as commercial_company_name, NULL AS commercial_partner_id, company_id, name AS company_name, 1 AS country_id, create_date, 1 AS create_uid, credit_limit, customer, date, debit_limit, display_name, email, employee, fax, function, '' AS invoice_warn_msg, '' AS invoice_warn, is_company, lang, NULL AS last_time_entries_checked, NULL AS message_bounce, NULL AS message_last_post, mobile, name, '' AS notify_email, opt_out, NULL AS parent_id, NULL AS partner_share, phone, ref, NULL AS sale_warn_msg, TRUE AS sale_warn, signup_expiration, signup_token, signup_type, state_id, street, street2, supplier, NULL AS team_id, NULL AS title, type, tz, NULL AS user_id, vat, website, write_date, 1 AS write_uid, zip
FROM res_partner_from_7
WHERE id NOT IN (SELECT id FROM res_partner)
Records created and available thru Odoo interface. But when I trying to create new record from interface (for example new partner) is raises duplication error (such id already exists). Looks like Odoo ignores existing in tables record or something like that. So maybe I need to do some additional steps to escape such problem ? Or I just cant migrate data accesing directly to tables ?
Upvotes: 0
Views: 98
Reputation: 6295
In Odoo every table has id
column and that is auto incrementing sequence. So you need to get last I'd from res_partner7
table and set the sequence next number on v10 db to last+1 id on you 7 db that would generate next record id unique as id filed has unique constraint.
Bests
Upvotes: 1