function fields inherited by prototyping still point to the old model
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned | ||
OpenERP Community Backports (Server) |
New
|
Undecided
|
Unassigned |
Bug Description
I have a first model:
class A(Model):
_name = 'my.name'
_columns = {
'test': fields.
store = {
'my.name': (lambda self, cr, uid, ids, context: ids, ['a trigger field'], 42),
}
now I inherit this one:
class B(Model):
_name = 'my.other.name'
_inherit = 'my.name'
What I get now is the same definition for the field 'test', resulting in the attempt to write ids from model 'my.name' into 'my.other.name'. I think when doing inheritance by prototyping, we should walk through the function fields and change eventual keys equal to _inherit to _name.
To verify, inherit res.partner by prototyping. Then all your writes will fail if there if no record of your new model with the same id.
Now I ask myself: Is it worth the effort to propose a patch for that? (the workaround is to redeclare the fields in question in the new model)
Is there any real world code that has problems because of this?