changeset 7a4a537f0f87 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=7a4a537f0f87
description:
Skip warnings for non-interactive operations
issue10096
review343671002
diffstat:
CHANGELOG | 1 +
trytond/ir/cron.py | 3 ++-
trytond/ir/queue.py | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diffs (37 lines):
diff -r 36ec54f7952c -r 7a4a537f0f87 CHANGELOG
--- a/CHANGELOG Sun Apr 11 18:22:36 2021 +0200
+++ b/CHANGELOG Mon Apr 12 17:44:16 2021 +0200
@@ -1,3 +1,4 @@
+* Skip warnings for non-interactive operations
* Check rule only if _check_access is set
* Add statistics to Cache
* Add support for avatars
diff -r 36ec54f7952c -r 7a4a537f0f87 trytond/ir/cron.py
--- a/trytond/ir/cron.py Sun Apr 11 18:22:36 2021 +0200
+++ b/trytond/ir/cron.py Mon Apr 12 17:44:16 2021 +0200
@@ -130,10 +130,11 @@
@classmethod
def run(cls, db_name):
+ transaction = Transaction()
logger.info('cron started for "%s"', db_name)
now = datetime.datetime.now()
retry = config.getint('database', 'retry')
- with Transaction().start(db_name, 0) as transaction:
+ with transaction.start(db_name, 0, context={'_skip_warnings': True}):
transaction.database.lock(transaction.connection, cls._table)
crons = cls.search(['OR',
('next_call', '<=', now),
diff -r 36ec54f7952c -r 7a4a537f0f87 trytond/ir/queue.py
--- a/trytond/ir/queue.py Sun Apr 11 18:22:36 2021 +0200
+++ b/trytond/ir/queue.py Mon Apr 12 17:44:16 2021 +0200
@@ -152,7 +152,8 @@
transaction = Transaction()
Model = Pool().get(self.data['model'])
with transaction.set_user(self.data['user']), \
- transaction.set_context(self.data['context']):
+ transaction.set_context(
+ self.data['context'], _skip_warnings=True):
instances = self.data['instances']
# Ensure record ids still exist
if isinstance(instances, int):