7.0: specifying view for o2m with context does not work without prefixing view id with module name

Bug #1214799 reported by Alexandre Fayolle - camptocamp
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Won't Fix
Wishlist
OpenERP's Framework R&D

Bug Description

In most places where a xml id is used to refer to an object defined in the same module, it is possible to use a shortcut and to refer to the object as "object_id" rather than "module.object_id".

However, this does not work when specifying a view in the context attribute of a field element typically in a one2many field, as mentionned in https://doc.openerp.com/trunk/server/03_module_dev_03/#using-the-context which is quite confusing.

I am not sure that this can be fixed, because the evaluation of the context is done at runtime rather than import time, and the module information may not be available then. But the documentation should mention this and emphasize it, because it is a real tricky point.

Side note: this non feature is used in the stock module (which I unfortunately had consulted to check the validity of my view...). Reported as lp:1214801

description: updated
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Indeed this is a common pitfall, but this is a rather advanced case and implementing the shortcut mechanism would probably require some rather ugly hacks, as the call to ``fields_view_get`` with the magic context value does not know from which view it comes.

Your doc update has been applied to the 7.0 documentation [1], and a warning has just been added in trunk [2], so we can probably live with this for the time being.

Thanks for reporting!

[1] server 7.0 revision 5055 rev-id: <email address hidden>
[2] server trunk revision 4939 rev-id <email address hidden>

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Wishlist
status: New → Won't Fix
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

The stock module needs fixing: lp:1217394

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.