[FIX] fields: throw truthy values on old api field

In 7.0, a field overriding an inherited model would overwrite all the
previously set field attributes. In v8 the new API allow us to keep
previous attribute, and only overwrite attributes of our wish.

Following the commit 7b1ef708 (october 2014) an old api field overriding
could conserve previous attributes values in some cases (if the new value
is falsy (None, "", 0, False, (), {}, [], ...) when it should not. It
was partly an optimization to diminish the size of orm registries
dictionaries to save memory (this patch has been tested with all odoo
modules and added +/- 3M).

This commit (proposed by rco) should overwrite falsy value (so the
behavior of v7 for old api fields overwritting is re-introduced) and
get back the behavior of old api in V7.

closes #7035
opw-639712
This commit is contained in:
Nicolas Lempereur 2015-06-10 16:06:10 +02:00
parent 5ada7bb0d0
commit 3269ad8f48
1 changed files with 2 additions and 2 deletions

View File

@ -211,8 +211,6 @@ class _column(object):
""" return a dictionary with all the arguments to pass to the field """
base_items = [
('copy', self.copy),
]
truthy_items = filter(itemgetter(1), [
('index', self.select),
('manual', self.manual),
('string', self.string),
@ -223,6 +221,8 @@ class _column(object):
('groups', self.groups),
('change_default', self.change_default),
('deprecated', self.deprecated),
]
truthy_items = filter(itemgetter(1), [
('group_operator', self.group_operator),
('size', self.size),
('ondelete', self.ondelete),