From f537694c8e135fe71b0b1498b05acb61fbddde79 Mon Sep 17 00:00:00 2001 From: Adam Heinz Date: Mon, 23 Dec 2024 16:59:44 -0500 Subject: [PATCH] [IMP] Allow super user to set log_access fields. This is helpful when importing data from external systems of record. --- odoo/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/odoo/models.py b/odoo/models.py index 8d3cfe6eaa8af..cf7fc0b24d966 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -4662,8 +4662,8 @@ def write(self, vals: ValuesType) -> typing.Literal[True]: bad_names = {'id', 'parent_path'} if self._log_access: - # the superuser can set log_access fields while loading registry - if not(self.env.uid == SUPERUSER_ID and not self.pool.ready): + # the superuser can set log_access fields + if not(self.env.uid == SUPERUSER_ID): bad_names.update(LOG_ACCESS_COLUMNS) # set magic fields @@ -5049,8 +5049,8 @@ def _prepare_create_values(self, vals_list): """ bad_names = ['id', 'parent_path'] if self._log_access: - # the superuser can set log_access fields while loading registry - if not(self.env.uid == SUPERUSER_ID and not self.pool.ready): + # the superuser can set log_access fields + if not(self.env.uid == SUPERUSER_ID): bad_names.extend(LOG_ACCESS_COLUMNS) # also discard precomputed readonly fields (to force their computation)