Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doblib/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.20.7"
VERSION = "0.20.8"
14 changes: 5 additions & 9 deletions src/doblib/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,14 @@ def env(self, db_name, rollback=False, minimal=False):
reg = Registry(db_name)
with closing(reg.cursor()) as cr:
uid = SUPERUSER_ID
env = Environment(cr, uid, {})
ctx = {}

if minimal:
# Prevent prefetching fields when creating a context
ctx = (
Environment(cr, uid, {})["res.users"]
.with_context(prefetch_fields=False)
.context_get()
)
env = Environment(cr, uid, ctx)

yield env
ctx["prefetch_fields"] = False
ctx.update(Environment(cr, uid, ctx)["res.users"].context_get())

yield Environment(cr, uid, ctx)

if rollback:
cr.rollback()
Expand Down
11 changes: 0 additions & 11 deletions src/doblib/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,6 @@ def update_changed(self, db_name, blacklist=None):
with self.env(db_name, False, minimal=True) as env:
model = env["ir.module.module"]
if hasattr(model, "upgrade_changed_checksum"):
# Initialize `res.company`, `res.partner` and `res.users` to prevent
# exceptions caused by the fetching of user data inside of the decorator
# `assert_log_admin_access`. Exceptions occur if an existing module
# adds a new field to `res.company`, `res.partner` or `res.users` which
# gets loaded inside of python but doesn't link to a column in the
# database
utils.info("Initializing the `res.users` and `res.company` models")
env.registry.init_models(
env.cr, ["res.company", "res.partner", "res.users"], env.context
)

model.upgrade_changed_checksum(True)
return

Expand Down