diff --git a/CHANGELOG b/CHANGELOG index 736d22661f..ace623e975 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 --git a/trytond/backend/sqlite/database.py b/trytond/backend/sqlite/database.py index 7bc7c46e1b..74bdf359bb 100644 --- a/trytond/backend/sqlite/database.py +++ b/trytond/backend/sqlite/database.py @@ -264,6 +264,14 @@ def least(*args): 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 @@ class Database(DatabaseInterface): 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)