[FIX] fields: add minimal support for serialized fields in new API
This is necessary for supporting old-api sparse and serialized fields. Without this, old-api serialized fields are broken because they cannot be converted to new-api fields. This closes #4571
This commit is contained in:
committed by
Raphael Collet
parent
1eb2507034
commit
5abcff8512
+8
-1
@@ -1751,6 +1751,14 @@ class Many2many(_RelationalMulti):
|
||||
_column_limit = property(attrgetter('limit'))
|
||||
|
||||
|
||||
class Serialized(Field):
|
||||
""" Minimal support for existing sparse and serialized fields. """
|
||||
type = 'serialized'
|
||||
|
||||
def convert_to_cache(self, value, record, validate=True):
|
||||
return value or {}
|
||||
|
||||
|
||||
class Id(Field):
|
||||
""" Special case for field 'id'. """
|
||||
store = True
|
||||
@@ -1774,7 +1782,6 @@ class Id(Field):
|
||||
def __set__(self, record, value):
|
||||
raise TypeError("field 'id' cannot be assigned")
|
||||
|
||||
|
||||
# imported here to avoid dependency cycle issues
|
||||
from openerp import SUPERUSER_ID
|
||||
from .exceptions import Warning, AccessError, MissingError
|
||||
|
||||
Reference in New Issue
Block a user