Merge lp:~openerp-dev/openerp-web/6.1-opw-576380-msh into lp:openerp-web/6.1

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-576380-msh
Merge into: lp:openerp-web/6.1
Diff against target: 13 lines (+4/-0)
1 file modified
addons/web/controllers/main.py (+4/-0)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-576380-msh
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Information
Review via email: mp+115069@code.launchpad.net

Description of the change

Hello,

Fixed the issue of active_id and active_ids, if there is not active_id or active_ids in context so passed False and [] respectively.

Demo -> Marketing/Reporting/Event Dashboard.
Got Error of active_id.

Generally this issue is not generated as we will not have any action on menu where we have passed active_id or active_ids which obvious thing that while we calling menu_action at that time we will not have the active_id or active_ids, but here why we are facing this issue is due to addons code, where we have reused the action defined for act_window, we have reused the action "act_event_list_register_event" defined for act_window in menu action board view, the action will work for act_window as there will be any active_record when you going to call act_window but this will not be true for menu action.

Hence to make the same behaviour as GTK sets False and [] for active_id and active_ids respectively, so that when action is reused it should not give error of context evaluation.

Thanks.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

1. Why should this be hacked around in the web client, instead of being fixed in the addons?
2. In any case, for that behavior I'd rather you use dict.setdefault I think.

review: Needs Information

Unmerged revisions

2408. By Mohammed Shekha(Open ERP)

[FIX]Fixed the issue of active_id not passed from menu_action.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/controllers/main.py'
2--- addons/web/controllers/main.py 2012-06-29 09:57:53 +0000
3+++ addons/web/controllers/main.py 2012-07-16 06:46:52 +0000
4@@ -685,6 +685,10 @@
5
6 if not do_not_eval:
7 # values come from the server, we can just eval them
8+ if 'active_id' not in eval_ctx:
9+ eval_ctx['active_id'] = False
10+ if 'active_ids' not in eval_ctx:
11+ eval_ctx['active_ids'] = []
12 if action.get('context') and isinstance(action.get('context'), basestring):
13 action['context'] = eval( action['context'], eval_ctx ) or {}
14