expression: fix m2o handling of empty lists [Bug 598454]
expression: fix m2o handling of empty lists [Bug 598454]

The domain expressions wouldn't yield the expected results in the
following cases (eg. for res.partner):
  [('company_id', 'in', [])] : should return [], not all partners
  [('company_id.partner_id', 'in', [])] : again, empty set

After some deliberation and discussion, we *change the behavior* for them.

Notes:
  1. This comes after commit 913e95856f80, bug 626806 which solved the
  corresponding cases for m2m, o2m
  2. This commit _will_ have side-effects. The result set for domains now
  is indeed different. But, we believe, now it is the proper one, fixes
  cases of unexpected results that have been reported
  3. It makes the server a bit faster, because empty results are quick to
  compute
  4. The "not in []" operator will NOT return results with NULL values in
  the corresponding field (aka. empty). This may not be the one expected
  by users, but it follows the SQL standard (par. 9.20.3):
    http://www.postgresql.org/docs/9.0/static/functions-subquery.html

xrg/openerp-server,xrg/openerp-server