I can demonstrate that this bug is severe, has two causes, and the most troubling is likely within the web module:
1) The fundamental issue is that context is lost, and this appears to occur within web/http.
2) The second issue is that osv.orm.fields_view_get() fails to extract context from the form.
Demonstration: (requires, import pdb)
A) For the pass through osv.orm.fields_view_get() that needs the referenced context, use pdb to manually inject (view_type + '_view_ref') into context, and the form will render correctly.
B) The pass through osv.orm.fields_view_get() that immediately precedes (A) above should extract (view_type + '_view_ref') from the referencing form, and add this to context, so the referenced context would be available to (A). It does not.
C) However, even if context were injected by fields_view_get() on its first pass (B), this context gets lost before entering the second pass(A) above. I noticed in the call stack from fields_view_get() up to http.py that at some point args are passed by value, not by reference, and I suspect this may be where context is lost.
I can demonstrate that this bug is severe, has two causes, and the most troubling is likely within the web module:
1) The fundamental issue is that context is lost, and this appears to occur within web/http.
2) The second issue is that osv.orm. fields_ view_get( ) fails to extract context from the form.
Demonstration: (requires, import pdb)
A) For the pass through osv.orm. fields_ view_get( ) that needs the referenced context, use pdb to manually inject (view_type + '_view_ref') into context, and the form will render correctly.
B) The pass through osv.orm. fields_ view_get( ) that immediately precedes (A) above should extract (view_type + '_view_ref') from the referencing form, and add this to context, so the referenced context would be available to (A). It does not.
C) However, even if context were injected by fields_view_get() on its first pass (B), this context gets lost before entering the second pass(A) above. I noticed in the call stack from fields_view_get() up to http.py that at some point args are passed by value, not by reference, and I suspect this may be where context is lost.