[FIX] fields: in to_column(), returning self.column is generally not correct
authorRaphael Collet <rco@openerp.com>
Wed, 8 Oct 2014 08:47:25 +0000 (10:47 +0200)
committerRaphael Collet <rco@openerp.com>
Wed, 8 Oct 2014 14:39:59 +0000 (16:39 +0200)
commit619a844428a46c731a6a4add0c73b6b963622993
tree9d882b13c9b3c66eac5b813a2231a741c4d4f8ea
parent10142d7dc7aa178d68c17c657d4ae445199a8aa0
[FIX] fields: in to_column(), returning self.column is generally not correct

Consider the following example:

    class Foo(models.Model):
        _name = 'foo'
        _columns = {
            'state': fields.selection([('a', 'A')]),
        }

    class Bar(models.Model):
        _inherit = 'foo'
        state = fields.Selection(selection_add=[('b', 'B')])

The attribute 'column' of the field does not have the full selection list,
therefore the column object cannot not be reused, even a copy of it.  The
solution is to systematically recreate the column from the field's final
specification, except for function fields that have no sensible way for being
recreated.
openerp/addons/test_inherit/__openerp__.py
openerp/addons/test_inherit/demo_data.xml [new file with mode: 0644]
openerp/addons/test_inherit/models.py
openerp/addons/test_inherit/tests/test_inherit.py
openerp/fields.py
openerp/models.py