From 7ac4639a24171e78bc3e8fe8d1fd95dd3de9c530 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 16 Mar 2015 15:31:43 +0100 Subject: [PATCH] [FIX] fields: fix determination of `field.selection` for custom fields In the case of custom fields, `field.selection` is set directly instead of being set in overridden fields. --- openerp/fields.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/openerp/fields.py b/openerp/fields.py index da357094285..da0ba4dc374 100644 --- a/openerp/fields.py +++ b/openerp/fields.py @@ -1267,20 +1267,18 @@ class Selection(Field): def set_class_name(self, cls, name): super(Selection, self).set_class_name(cls, name) # determine selection (applying 'selection_add' extensions) - selection = None for field in resolve_all_mro(cls, name, reverse=True): if isinstance(field, type(self)): # We cannot use field.selection or field.selection_add here # because those attributes are overridden by `set_class_name`. if 'selection' in field._attrs: - selection = field._attrs['selection'] + self.selection = field._attrs['selection'] if 'selection_add' in field._attrs: # use an OrderedDict to update existing values selection_add = field._attrs['selection_add'] - selection = OrderedDict(selection + selection_add).items() + self.selection = OrderedDict(self.selection + selection_add).items() else: - selection = None - self.selection = selection + self.selection = None def _description_selection(self, env): """ return the selection list (pairs (value, label)); labels are