Root cause: When active field is set to False, the record becomes invisible to standard searches. If auditlog reads old/new values after the write, the record is already filtered out by Odoo's default active_test=True context, resulting in empty read and no log entry being created.
Fix: Use with_context(active_test=False) when reading values in the write hook:
pythonold_values = records.with_context(active_test=False).read(list(fields))
Root cause: When active field is set to False, the record becomes invisible to standard searches. If auditlog reads old/new values after the write, the record is already filtered out by Odoo's default active_test=True context, resulting in empty read and no log entry being created.
Fix: Use with_context(active_test=False) when reading values in the write hook:
pythonold_values = records.with_context(active_test=False).read(list(fields))