Odoo allows creating or updating records with values like ``{"many2one_field_id": empty.recordset()}``,
but this crashes when using ``deepcopy``, which fails in recreating the ``api.Environment`` object
attached to the recordset.
This commit should fix the issue by updating the values before passing them to ``deepcopy``.
Add database indices on the foreign key fields of the auditlog models.
Without these indices, the performance of the autovacuum cron are terrible
because the "ON DELETE SET NULL" trigger has to make a full table scan
on the auditlog_log and auditlog_log_line tables when
auditlog_http_session and auditlog_http_request rows are deleted.
When a field or a model is unlinked, keep the related audit logs. Denormalize
the field and model info on the logs and log lines so that the information
is still available after the deletion of the related data model.
Also, to improve the performance of the deletion of fields and models,
add indexes on the log's model_id and log line's field_id.
Co-Authored-By: Stefan Rijnhart <stefan@opener.am>
Fixing #1134.
Odoo stores values of computed fields at the end of the transaction
only, as such performing a 'read()' to make a data snapshot on the record
created in the current transaction doesn't return the expected result
regarding these fields.
Also as a side-effect 'read()' alters the environment cache and break the
values on the record inducing issues in the whole user
transaction/workflow.
This fix replaces the use of 'read()' to do the data snapshot directly
from the cache of the record (computed values are already there).
* Update _patch_methods and _revert_methods in auditlog.rule model to properly
track whether a method has already been patched for logging purposes. This
prevents duplicate logs from being produced in various cases (e.g. when a
logging rule is created as part of a module install)
- Update documentation to point to the new auditlog menu locations. These were changed because the 8.0 version was referencing menus that do not exist in 9.0
- Change version from 8.0.X.Y.Z to 9.0.1.0.0
- Make the module installable again
- Remove an unused parameter from pre-migration.py for versioning
- Fix typos and remove commented out blocks of code that were irrelevant