Keep who created a record, and when
Import the original creation and last update user and date of records when migrating to Odoo, instead of the date of the import.
The real history
Customers keep the date they became a customer, and documents the user who created them in the old system.
Any model
Works for every record with the standard
create_uid, create_date,
write_uid and write_date fields.
Safe by default
Only for administrators, and only when asked for with a context key. Everything else imports exactly as before.
How to import the metadata
Import as an administrator with write_metadata in the
context, and add any of the four columns. For example with
load() through XML-RPC or JSON-RPC:
models.execute_kw(db, uid, password, "res.partner", "load",
[["id", "name", "create_uid/id", "create_date"],
[["legacy.p_vermeer", "Vermeer Logistics", "legacy.u_anna", "2016-03-01 08:30:00"]]],
{"context": {"write_metadata": True, "tz": "UTC", "mail_create_nolog": True}})
-
Users by name (
create_uid), XML ID (create_uid/id) or database id (create_uid/.id), like any many2one column. -
Dates as
YYYY-MM-DD HH:MM:SS. Add"tz": "UTC"to import UTC dates unchanged. -
"mail_create_nolog": Truekeeps Odoo from adding a created message of today to the chatter.
The original user and date, on the record
A contact imported with its history, in the Metadata of the developer tools:
Good to know
- Any later change to a record sets its last update user and date again, as usual in Odoo.
- For other users, or without the context key, the columns are ignored and the import does not fail.
- Import the chatter history too with Import Res ID. Part of the Fluvo toolset for fast data import and export in Odoo. Open source under the LGPL-3 license.
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 75 |
| Technical Name |
import_metadata |
| License | LGPL-3 |
| Website | https://github.com/GetFluvo/addons |
Please log in to comment on this module