changeset c235ae817e5d in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=c235ae817e5d
description:
Skip trigger using contextual key
Relying on the user is not flexible enough.
issue8993
review260841002
diffstat:
trytond/ir/trigger.py | 2 +-
trytond/modules/__init__.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r b0e96608c7b3 -r c235ae817e5d trytond/ir/trigger.py
--- a/trytond/ir/trigger.py Fri Jan 24 00:19:52 2020 +0100
+++ b/trytond/ir/trigger.py Wed Jan 29 00:03:40 2020 +0100
@@ -147,7 +147,7 @@
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)
diff -r b0e96608c7b3 -r c235ae817e5d trytond/modules/__init__.py
--- a/trytond/modules/__init__.py Fri Jan 24 00:19:52 2020 +0100
+++ b/trytond/modules/__init__.py Wed Jan 29 00:03:40 2020 +0100
@@ -352,7 +352,8 @@
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'