7.0: specifying view for o2m with context does not work without prefixing view id with module name
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:/
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
Related branches
- OpenERP Core Team: Pending requested
-
Diff: 20 lines (+10/-1)1 file modifieddoc/03_module_dev_03.rst (+10/-1)
description: | updated |
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>