changeset fae3761b96da in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=fae3761b96da
description:
Add BOOL_AND and BOOL_OR to SQLite backend
issue10316
review330801002
diffstat:
CHANGELOG | 2 ++
trytond/backend/sqlite/database.py | 10 ++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diffs (36 lines):
diff -r 4384c9d0a419 -r fae3761b96da CHANGELOG
--- a/CHANGELOG Sun May 16 17:52:30 2021 +0200
+++ b/CHANGELOG Sun May 16 18:09:28 2021 +0200
@@ -1,3 +1,5 @@
+* Add BOOL_AND and BOOL_OR to SQLite backend
+
Version 6.0.0 - 2021-05-03
* Bug fixes (see mercurial logs for details)
* Allow column sql types to be tested from the table handler
diff -r 4384c9d0a419 -r fae3761b96da trytond/backend/sqlite/database.py
--- a/trytond/backend/sqlite/database.py Sun May 16 17:52:30 2021 +0200
+++ b/trytond/backend/sqlite/database.py Sun May 16 18:09:28 2021 +0200
@@ -264,6 +264,14 @@
return None
+def bool_and(*args):
+ return all(args)
+
+
+def bool_or(*args):
+ return any(args)
+
+
def cbrt(value):
return math.pow(value, 1 / 3)
@@ -354,6 +362,8 @@
self._conn.create_function('now', 0, now)
self._conn.create_function('greatest', -1, greatest)
self._conn.create_function('least', -1, least)
+ self._conn.create_function('bool_and', -1, bool_and)
+ self._conn.create_function('bool_or', -1, bool_or)
# Mathematical functions
self._conn.create_function('cbrt', 1, cbrt)