Short answer: have a look at the way the CSV Import and Export wizard work - exporting a record automatically creates an external identifier so you can re-import that same CSV and the record will be updated rather than re-created.
Long answer:
OpenERP stores external IDs in the ir.model.data
table, which you can access in the user interface via the Settings menu 1. This simple table maps an "External Identifier" in the form module_name.record_identifier
to a pair (model,res_id)
that points to the actual table and row.
These external IDs are used to find the database-local row that corresponds to a record created by some external source: a module (hence the module
-based namespace) or an imported CSV file, usually.
For example the external identifier base.EUR
maps to the database records that holds the EUR currency in the database, and is owned by the base
module.
As of version 6.1, OpenERP automatically creates new external identifiers for all OpenERP records that are exported using the sidebar Export wizard: they're exported in a CSV column named id
.
And if such an id
column is present in a CSV file that is imported via the Import wizard, OpenERP will also create an external identifier to remember it. And when the external identifier already exists, the record is updated rather than created.
In theory, all you have to do is produce a proper CSV file with an extra id
column2 from your master database (you could even use the actual DB ID), and import it in OpenERP. You should then be able to re-import updated versions of this CSV file whenever you want.
References:
- The Import and Export wizards basically call the API methods export_data and import_data, so you can script this via XML-RPC if needed.
- The
ir.model.data
model stores the external identifiers (historically called XML IDs because it corresponds to the id
field of XML records in module data files).
1 In OpenERP 6.1 it is located under Settings>Configuration>Sequences & Identifiers>External Identifiers, and in OpenERP version 7 under Settings>Technical>Sequences & Identifiers>External Identifiers.
2 can be any string with no dot ".
" character in it: it will be stored in a special __export__
module namespace)