Skip to content

Commit 86e8eb4

Browse files
committed
Merge PR #538 into 17.0
Signed-off-by lmignon
2 parents 8526894 + 96f39ac commit 86e8eb4

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fastapi/fastapi_dispatcher.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,10 @@ def _manage_odoo_env(self, uid=None):
115115
token = odoo_env_ctx.set(env)
116116
try:
117117
yield
118+
# Flush here to ensure all pending computations are being executed with
119+
# authenticated fastapi user before exiting this context manager, as it
120+
# would otherwise be done using the public user on the commit of the DB
121+
# cursor, what could potentially lead to inconsistencies or AccessError.
122+
env.flush_all()
118123
finally:
119124
odoo_env_ctx.reset(token)

0 commit comments

Comments
 (0)