[FIX] core: don't fail when reading recordset with ids [None]
The revision 65a012c2bba0ed81d9b525a7779c726043b17707 changed the behavior of method _read() when invoked on a record with id None. Before the change, the method would consider that no records have been fetched because the id is falsy. After the change, it keeps the id None in the fetched records, and attempts to make subsequent SQL queries like "column IN ()", which is syntactically incorrect. OPW 3104957 closes odoo/odoo#108785 X-original-commit: 712d03cb2ee5f2fde0e80619be5db38aa09ed1ac Signed-off-by: Rémy Voet <ryv@odoo.com> Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
@@ -1672,6 +1672,9 @@ class TestFields(TransactionCaseWithUserDemo):
|
||||
with self.assertRaises(MissingError):
|
||||
deleted.categories
|
||||
|
||||
# special case: should not fail
|
||||
Discussion.browse([None]).read(['categories'])
|
||||
|
||||
def test_40_real_vs_new(self):
|
||||
""" test field access on new records vs real records. """
|
||||
Model = self.env['test_new_api.category']
|
||||
|
||||
+1
-1
@@ -3231,7 +3231,7 @@ class BaseModel(metaclass=MetaModel):
|
||||
self = self.exists()
|
||||
self.check_access_rule('read')
|
||||
|
||||
result = [(id_,) for id_ in self._ids]
|
||||
result = [(id_,) for id_ in self.ids]
|
||||
|
||||
fetched = self.browse()
|
||||
if result:
|
||||
|
||||
Reference in New Issue
Block a user