fields_view_get builds a generic view although an inherited view is available
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Opinion
|
Wishlist
|
OpenERP's Framework R&D |
Bug Description
When no view is defined on a model, the "fields_view_get" method builds a generic view (displaying for instance for a form all fields of the model on 2 columns without any other design consideration).
Unfortunately this behavior of "fields_view_get" may also occur although a view is well defined on the model.
It is the case when the expected view is inherited from a view of another model, typically an abstract model.
To reproduce, define a model like this:
class my_partner_
_name = 'my.partner.
_inherit = ['res.partner.
_columns = {
'my_field': fields.
}
... a view, an action and a menu like this:
<record id="view_
<field name="name"
<field name="model"
<field name="inherit_id" ref="base.
<field name="arch" type="xml">
</record>
<record id="my_
<field name="name"
<field name="res_
<field name="view_
<field name="view_
</record>
<menuitem id="my_
Click on the MPC menu then Create => a generic view not inherited from base.view_
Many thanks to fix this issue on [7.0] official branch.
A MP on [7.0] follows.
Related branches
- Olivier Dony (Odoo): Disapprove
- Thibault Delavallée (OpenERP): Pending requested
-
Diff: 24 lines (+8/-1)1 file modifiedopenerp/osv/orm.py (+8/-1)
Hi,
This is actually the expected behavior. Constructing the main view by inheriting one from another model is a (rather undocumented) technique to spare the view duplication in some rare cases. We prefer to force the developer to make this decision explicit by setting the corresponding view_id in the actions where it is relevant, so it won't happen accidentally.
The alternative is likely to introduce random surprises when developers fail to properly care about the priority of their inherited views (which used to be irrelevant).
We could reconsider this if a new and more explicit way to define foreign-view inheritance was introduced, but not with the current "hackish" technique. I hope you understand.
Thanks,