Skip trigger using contextual key

Relying on the user is not flexible enough.

issue8993
review260841002
This commit is contained in:
Cédric Krier committed 2020-01-29 00:03:40 +01:00
1 parent ae32a1a45a
commit 750ad14bb2
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -147,7 +147,7 @@ class Trigger(DeactivableMixin, ModelSQL, ModelView):
assert mode in ['create', 'write', 'delete', 'time'], \
'Invalid trigger mode'
if Transaction().user == 0 and not Transaction().context.get('user'):
if Transaction().context.get('_no_trigger'):
return []
key = (model_name, mode)
+2 -1
View File
@@ -352,7 +352,8 @@ def load_modules(
global res
transaction = Transaction()
with transaction.connection.cursor() as cursor:
with transaction.set_context(_no_trigger=True), \
transaction.connection.cursor() as cursor:
# Migration from 3.6: remove double module
old_table = 'ir_module_module'
new_table = 'ir_module'