M.E.
M.E.

Reputation: 5505

Odoo 10 - update external ID

I would like to be able to update the external ID of a record.

Say for example that you create a UOM (Unit of Measure) or a provider. You will get things like __export__.product_uom_20

If you want later to use that reference in a CSV import, you might want to rename the external ID to something more friendly before doing the import, such as: __export__.product_uom_myspecialbox. So the CSV becomes more meaningful.

Is is possible to modify the external ID of a given record in Odoo 10? If so, how is it done?

Upvotes: 0

Views: 2009

Answers (1)

You can change the external ID on the UI by going to

Settings -> Technical ->  Sequences and Identifiers -> External Identifiers

And there you just need to modify the name field once you found the record you want to modify.

If you want to do this programatically, you will need to modify the ir.model.data object, for example:

env['ir.model.data'].search(
            [('name', '=' old_external_id)]).name = new_external_id

Where env is an odoo.api.Environment object with the appropriate permissions.

Upvotes: 4

Related Questions