c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #35095
[Bug 865308] Re: Context is not evaluted on one2many fields
*** This bug is a duplicate of bug 865048 ***
https://bugs.launchpad.net/bugs/865048
Ok, now I was able to investigate.
The problem with the 'date' field in the o2m was a bug I recently
corrected, so it's not happening anymore.
About the active_id, it's normal it doesn't work in this case in the web
client. active_id is supposed to be the id of the record in the
preceding view. In the gtk client, there is always a preceding view. If
you come from a menu, the preceding model is assumed to be ir.ui.menu
and the active_id is the id of the menu.
The new web client doesn't do that because:
1 - It doesn't work the same way, the menu is not a view like any other else
2 - We never had any case in the OpenERP addons where it was useful to get the id of a menu.
3 - There was a lot of addons that were incorrectly coded and that assumed that active_id was the id of a record in the xxx model (replace xxx by any model except ir.ui.menu).
So we decided to not simulate that functionality in the new web client,
since it's useless and tends to produce programming errors.
So, you can still use the active_id, but only when you come from a
form/list/anything view, not from a menu. If you're not sure, you can
test the active_id is defined by doing something like: {'neither_this' :
context.get('active_id', False)} .
** Changed in: openerp-web
Status: New => Fix Released
** This bug has been marked a duplicate of bug 865048
on creating Question from survey : found Traceback
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP Project Group.
https://bugs.launchpad.net/bugs/865308
Title:
Context is not evaluted on one2many fields
Status in OpenERP Web:
Fix Released
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/openerp-web/+bug/865308/+subscriptions
References