summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorqdp-odoo <qdp@odoo.com>2016-12-30 17:20:36 +0100
committerqdp-odoo <qdp@odoo.com>2016-12-30 17:21:25 +0100
commit4f29b77e3d1677ffc88336cc99fb7f09d49d7dd1 (patch)
tree0642a57228cc2e0e3ab04d5afbfb5adf882b689c /odoo/fields.py
parent33a413eb2944db4a35d035f42161159ae53dd830 (diff)
[MERGE] foward port of 10.0 up to revision 84a650e33aadb29661121410813e3de37a5ad3e9
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index 90f4b2f943c..3240b83d801 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -1578,6 +1578,7 @@ class Datetime(Field):
class Binary(Field):
type = 'binary'
_slots = {
+ 'prefetch': False, # not prefetched by default
'attachment': False, # whether value is stored in attachment
}
@@ -1747,6 +1748,14 @@ class Selection(Field):
return item[1]
return False
+ def convert_to_column(self, value, record):
+ """ Convert ``value`` from the ``write`` format to the SQL format. """
+ if value is None or value is False:
+ return None
+ if isinstance(value, unicode):
+ return value.encode('utf8')
+ return str(value)
+
class Reference(Selection):
type = 'reference'
@@ -2398,6 +2407,9 @@ class Many2many(_RelationalMulti):
class Serialized(Field):
""" Serialized fields provide the storage for sparse fields. """
type = 'serialized'
+ _slots = {
+ 'prefetch': False, # not prefetched by default
+ }
column_type = ('text', 'text')
def convert_to_column(self, value, record):