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

how to update external id?

By
Andrea Dalseno
on 4/22/14, 1:53 PM 7,689 views

How can I update the external_id? I've made a mistake during an import and I have some record with the wrong external_id in the form "res_partner_XXX" where XXX is the record id. How can I update those records with a csv file? I tried to import the csv in the external identifiers section, but with no luck: a new record is created instead of updating the old one (V 7.0) Is there a way to do it?

1

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 4/22/14, 7:21 PM

Please be careful when doing this!

Every OpenERP module uses External ID's to "add" and/or "locate and update" information in the system. Changing or Deleting External ID records can cause serious limitations to the ability to install or upgrade modules in the future.

Make sure you understand what you are doing and change only External ID's related to data YOU have imported into OpenERP.


To access the record that contains the External ID for a particular database record, visit
Settings --> Technical --> Sequences and Identifiers --> External Identifiers

Each External ID maps to a Database Record ID. You will see that an External ID is constructed by a concatenation of the Module and External Identifier field.


ID and Export before change:

image description


image description


ID and Export after change:

image description


image description

Hi Ray, yes I've seen such approach and it can actually fix my needs, but I wondered if there was a way to do it in batch for all the "wrong" records importing some sort of csv file. Eternal ID, in my mind, should be exactly what the name suggests: the ID coming from an external source. And that's what I will use it for: connect the exported data to a different app. I think, but I might be wrong, that a simple csv file with just two columns, the primary key for the record and the "new" value for the external ID should do the work, but I can't figure out the right combination of fields to use.

Andrea Dalseno
on 4/23/14, 5:26 AM

You got it perfectly right, that's exactly what I need to do, but I wonder: is there a way to change the external id from state_us_105 to state_us_110 using a csv file so that I can change all my "wrong" record as a whole instead of doing it by hand one record a time? What combination of columns should such a file contain to get the job done? I tried different combinations (with a csv containing just one record for testing) with no luck: I couldn't find a way to update the external id. Or the validate process fails either a new record is created!

Andrea Dalseno
on 4/23/14, 6:13 AM
0
Mind And Go
On 4/22/14, 5:28 PM

Hy,

External ID are very sensitive parts of OpenERP. In order to get things getting better you have to rework as the server does in its porcess while updating modules. First Identify the view you want to be updated through an XML Id. Consider its name and its ID in the URL. Then go to Configuration > sequences & Ids > External Ids and filter on the object ir.ui.view and the ID you kept before. Check if you have an XML id defind here for you view. If it is not the case, that means that you won't be able to update your view by updating a module. Two possibilities for you : - recreate in OpenERP via web a new external id with the same name and same module as the one you have in your module and set the res_id to the ID already identified - You already have one but with a weird xml_id. So consider my first item and try to find why there was such a weird xml_id associéted to your view. Then consider to break the weird association or maybe consider duplicating the view as well as xml_id

Hope it could help

Thank you, I'm not actually trying to update a view, but the database itself. I will use the external id to move data into another application in which the external id is the primary key for the customer (or to update records in openerp with the other app data; it work fine base upon eternal id). I tried to figure out how to make such an update exporting all the columns from the external identifiers section, but I haven't been able to find a combination of columns form my csv so that I can update the records with the wrong external id. Opererp won't update, at least it creates a new record!

Andrea Dalseno
on 4/22/14, 5:48 PM

Hy Andrea, I think you forget something, once the modules have been loaded in OpenERP, all the views that are used are the one stored in database. I'm not sure to understand what you really want? Do you need to export arch + external_id? if it's the case, consider exporting datas from the ir.ui.view menu the one that list all the views in OpenERP

Mind & Go, Mind And Go
on 4/22/14, 6:10 PM

What I need is a way to update the external id for some customer that got the wrong external id (my mistake during an import, all the other datas are correct) using a csv file instead of doing it by hand one by one. When I export, for example, customer data in a csv file, I will use the external ID to match customer PK in another app and do what I got to do. It's not a matter of module or view, the problem regards the data: since I can change the external id value by hand, as shown below, I'd like to find a way to do it in batch using a csv file. Hope now my needs are clearer.

Andrea Dalseno
on 4/23/14, 5:34 AM

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

0 follower(s)

Stats

Asked: 4/22/14, 1:53 PM
Seen: 7689 times
Last updated: 3/16/15, 8:10 AM