From 3269ad8f488d2dc28763c2d2a2bfae1548db9ee6 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 10 Jun 2015 16:06:10 +0200 Subject: [PATCH] [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 --- openerp/osv/fields.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index 00eba168552..d9ee87901fb 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -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),