Sometimes it is useful to have a full picture of what changes happened on a record. This is often the case to understand how a document ended in a specific state (for example a sale on which it was applied a amendment).
For now we have the basic create/write logs on the records which is often not enough. And we may have the history but it is not always activated and it can be very data consuming.
So we would need an intermediary log system which provides enough to understand the sequence of events but not too much to slow or fill the database.
We add a new
ResourceMixin kind of model to log external event that happen to a record.
By external we mean from direct call of user which means when the
_check_access is set.
By events we mean the
delete calls but also the
Log model is append only and we use the
create_date as log data.
The event is stored in a
As extra data for
button we store the button name, for
wizard the wizard name and for the
transition the state.
transition is the only event that will not be linked to a user (because it is either triggered by a button which will already have an entry or as callback of other event which should not be assigned to the user).
The “View Logs…” popup of the clients is extended to display the list of log entries. If the model has history activated, opening the log entry opens the record at the datetime of the entry.
ModelStorage._log allows to deactivate for the model this mechanism. All
ir.* models have the log deactivated.