Compute quantities query could crash when executed as root user
The compute_quantities_query [1] (products_by_location in 3.0) [2] method considers the ir.rule domain of stock.move [3] when selecting stock moves. When executed as the root user, the domain_get method in ir.rule returns None (correctly), but the stock module tries to set a default (Literal(True)) in such cases [4].
This default seems to be incorrect as the move_rule_query is used with in_ queries [5][6] and the obvious expectation would be an array.
The SQL error is:
ProgrammingError: syntax error at or near "true"
LINE 1: ... AND ("b"."to_location" IN (3))) AND ("b"."id" IN true)) AND...
[1] https://github.com/tryton/stock/blob/faf478a23d64b7d0a9aa4a620bf2f26ecc7b0d8b/move.py#L813
[2] https://github.com/tryton/stock/blob/3.0/product.py#L118
[3] https://github.com/tryton/stock/blob/faf478a23d64b7d0a9aa4a620bf2f26ecc7b0d8b/move.py#L866
[4] https://github.com/tryton/stock/blob/faf478a23d64b7d0a9aa4a620bf2f26ecc7b0d8b/move.py#L868
[5] https://github.com/tryton/stock/blob/faf478a23d64b7d0a9aa4a620bf2f26ecc7b0d8b/move.py#L1053
[6] https://github.com/tryton/stock/blob/faf478a23d64b7d0a9aa4a620bf2f26ecc7b0d8b/move.py#L1062