Comment 5 for bug 865308

Revision history for this message
Thibaut DIRLIK (Logica) (thibaut-dirlik) wrote : Re: [Bug 865308] Re: Context is not evaluted on one2many fields

Ok Naresh you are right, it is passed in the context of the methods
correctly.

Anyway, there still have a problem : The Web Client (6.1, openerp-web) stops
loading the view when it encounter these error.

2011/10/14 Naresh(OpenERP) <email address hidden>

> Hello Thibaut Dirlik,
>
> Well this is not a bug ..let me elaborate a bit...
>
> As you must be aware that context on O2M can have values like
> "form_view_ref","tree_view_ref","group_by","model fields from view"
> etc......Now as some context are required to be evaluated at the start
> i.e while creating the view at client such as form/tree_view_ref,
> group_by etc so that they can be used to perform their task. Now if we
> look at your scenario then you will have a traceback because of the
> context eval at view creation but if you see that the same context is
> being passed in the methods that needs it..like
> fields_view_get,read,create,default_get,etc..... In short I mean is that
> the traceback want cost you anything !
>
> Can you please have a look at the context dict that you receive in the
> method that you intended !
>
> Correct me if I am missing something !
>
> regards,
> Naresh
>
>
>
> ** Changed in: openobject-client
> Status: Confirmed => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/865308
>
> Title:
> Context is not evaluted on one2many fields
>
> Status in OpenERP GTK Client:
> Incomplete
>
> Bug description:
> Hi,
>
> I'm working on the trunk branch (updated this morning). When
> specifying a context on a one2many field in its "field" XML atg, it
> doesn't work. I join a module so you can test and reproduce the bug
> easily.
>
> Example :
>
> <!-- A many2one, it's ok -->
> <field name="user_id" context="{'temporal_date' : date, 'dummy' :
> active_id}"/>
> <!-- A one2many, it's does't work -->
> <field name="fake_object_child_ids" context="{'this_does_not_work' : date,
> 'neither_this' : active_id}"/>
>
> I got this error on GTK client :
>
> Traceback (most recent call last):
> File "/home/thibaut/OpenERP 6/Logica/client/bin/tools/__init__.py", line
> 52, in expr_eval
> temp = eval(string, context)
> File "<string>", line 1, in <module>
> NameError: name 'date' is not defined
>
> And the same error with the active_id variable, whereras the first
> context work perfectly fine.
>
> This is going to be a problem for the future base_temporal module : we
> won't be able to pass the temporal_date variable in the context based
> on a current form field. Moreover, not being able to use active_id in
> the context of a one2many field also is a problem to define default
> values in the one2many form view.
>
> I hope this could be fixed before the 6.1 (7.0? ;-) !
>
> Thanks for your time,
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-client/+bug/865308/+subscriptions
>