Merge lp:~openerp-dev/openobject-addons/7.0-opw-591036-acl into lp:openobject-addons/7.0

Proposed by Anaël Closson (openerp)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-591036-acl
Merge into: lp:openobject-addons/7.0
Diff against target: 48 lines (+11/-4)
2 files modified
share/static/src/js/share.js (+8/-3)
share/wizard/share_wizard.py (+3/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-591036-acl
Reviewer Review Type Date Requested Status
Xavier (Open ERP) Pending
Review via email: mp+166812@code.launchpad.net

Description of the change

FIX OPW 591036 :

Corrects some of the share module behavior :
 * malformed url : calls `http://hostname/login` for login, and uses `active_id` parameter instead of `active`
 * search domain gathered from an improper place that seems to be empty in some cases
   => changed to use the searchview domain information instead

To post a comment you must log in.

Unmerged revisions

9182. By Anaël Closson (openerp)

[FIX] OPW 591036 : share wizard returns action_id instead of action in share url + incorrect url + wrong domain retreival

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'share/static/src/js/share.js'
--- share/static/src/js/share.js 2012-12-15 16:28:57 +0000
+++ share/static/src/js/share.js 2013-05-31 14:47:27 +0000
@@ -6,15 +6,20 @@
6 function launch_wizard(self, view, user_type, invite) {6 function launch_wizard(self, view, user_type, invite) {
7 var action = view.getParent().action;7 var action = view.getParent().action;
8 var Share = new session.web.DataSet(self, 'share.wizard', view.dataset.get_context());8 var Share = new session.web.DataSet(self, 'share.wizard', view.dataset.get_context());
9 var domain = new session.web.CompoundDomain(view.dataset.domain);9 view_manager = view.getParent();
10 while (view_manager.searchview == void 0) {
11 view_manager = view.getParent();
12 }
13 var search_data = view_manager.searchview.build_search_data();
14 var domain = new session.web.CompoundDomain(search_data.domains);
10 if (view.fields_view.type == 'form') {15 if (view.fields_view.type == 'form') {
11 domain = new session.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]);16 domain = new session.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]);
12 }17 }
13 if (view.fields_view.type == 'form') rec_name = view.datarecord.name;18 if (view.fields_view.type == 'form') rec_name = view.datarecord.name;
14 else rec_name = '';19 else rec_name = '';
15 session.web.pyeval.eval_domains_and_contexts({20 session.web.pyeval.eval_domains_and_contexts({
16 domains: [domain],21 domains: search_data.domains,
17 contexts: [view.dataset.context]22 contexts: search_data.contexts
18 }).done(function (result) {23 }).done(function (result) {
19 Share.create({24 Share.create({
20 name: action.name,25 name: action.name,
2126
=== modified file 'share/wizard/share_wizard.py'
--- share/wizard/share_wizard.py 2013-05-21 07:55:53 +0000
+++ share/wizard/share_wizard.py 2013-05-31 14:47:27 +0000
@@ -87,13 +87,15 @@
87 # NOTE: take _ids in parameter to allow usage through browse_record objects87 # NOTE: take _ids in parameter to allow usage through browse_record objects
88 base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='', context=context)88 base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='', context=context)
89 if base_url:89 if base_url:
90 base_url += '/login?db=%(dbname)s&login=%(login)s&key=%(password)s'90 base_url += '/?db=%(dbname)s&login=%(login)s&key=%(password)s'
91 extra = context and context.get('share_url_template_extra_arguments')91 extra = context and context.get('share_url_template_extra_arguments')
92 if extra:92 if extra:
93 base_url += '&' + '&'.join('%s=%%(%s)s' % (x,x) for x in extra)93 base_url += '&' + '&'.join('%s=%%(%s)s' % (x,x) for x in extra)
94 hash_ = context and context.get('share_url_template_hash_arguments')94 hash_ = context and context.get('share_url_template_hash_arguments')
95 if hash_:95 if hash_:
96 base_url += '#' + '&'.join('%s=%%(%s)s' % (x,x) for x in hash_)96 base_url += '#' + '&'.join('%s=%%(%s)s' % (x,x) for x in hash_)
97 # FIXME unfortunately, doesn't work for action_id, renaming to action
98 base_url = base_url.replace('action_id=', 'action=')
97 return base_url99 return base_url
98100
99 def _share_root_url(self, cr, uid, ids, _fieldname, _args, context=None):101 def _share_root_url(self, cr, uid, ids, _fieldname, _args, context=None):