You have been requested to review the proposed merge of lp:~thibaut-dirlik/openobject-server/fix-inherits-bug-303455 into lp:openobject-server.
For more details, see: https://code.launchpad.net/~thibaut-dirlik/openobject-server/fix-inherits-bug-303455/+merge/72914 The _inherits problem is complicated to solve with the current implementation. Because of the multiple-inheritance allowed by _inherits, parents can have fields with the same name that children. When you create a new objects which uses _inherits, OpenERP will fill ONE of its parent field with the value specified in a field. For example,n if "active" = True, OpenERP will create the parent and set active to True for it. But if the object have a "active" field too, it won't be defined. This small patch make OpenERP sets the value for the current object first, and, if the current object does not have a column, but the parent does, for its parent. Their are implementation choices to do : - What do to in case of multiple parents ? Currently, self._inherit_fields is a "mixin" and indeteminated because of the non-ordered state of the _inherits dict. So, the last read _inherits value is placed in the _inherit_fields attributen in the case multiple parent avec common fields. - Unless this implementation change, it won't be possible to modify all the parent at once. I wanted to set the value for all parents + the current object, but it's not possible unless we change the current _inherits implementation. So, I just did that. -- https://code.launchpad.net/~thibaut-dirlik/openobject-server/fix-inherits-bug-303455/+merge/72914 Your team OpenERP Community is requested to review the proposed merge of lp:~thibaut-dirlik/openobject-server/fix-inherits-bug-303455 into lp:openobject-server.
=== modified file 'openerp/osv/orm.py' --- openerp/osv/orm.py 2011-08-11 18:12:17 +0000 +++ openerp/osv/orm.py 2011-08-25 15:17:17 +0000 @@ -4050,7 +4050,7 @@ (upd0, upd1, upd2) = ('', '', []) upd_todo = [] for v in vals.keys(): - if v in self._inherit_fields: + if v in self._inherit_fields and v not in self._columns: (table, col, col_detail) = self._inherit_fields[v] tocreate[table][v] = vals[v] del vals[v]
_______________________________________________ Mailing list: https://launchpad.net/~openerp-community Post to : openerp-community@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community More help : https://help.launchpad.net/ListHelp