[FIX] share: find action's id by reverse-matching on the view_id instead of the view name, as the name can be localized (and will fail to match for non-english installations, or even potentially non-US-english installations for some view)

bzr revid: xmo@openerp.com-20110120113929-9tp1e9nadbgcgnki
This commit is contained in:
Xavier Morel 2011-01-20 12:39:29 +01:00
parent 21724da22b
commit 1168590120
3 changed files with 7 additions and 10 deletions

View File

@ -22,7 +22,7 @@
{
"name" : "Sharing Tools",
"version" : "1.1",
"version" : "1.2",
"depends" : ["base"],
"author" : "OpenERP SA",
"category": 'Generic Modules',

View File

@ -13,18 +13,15 @@ class ShareWizardController(openerp.controllers.SecuredController):
_cp_path = "/share"
@expose()
def index(self, domain, search_domain, context, name):
def index(self, domain, search_domain, context, view_id):
context = ast.literal_eval(context)
view_name = context.get('_terp_view_name') or name
if not view_name: return
action_id = rpc.RPCProxy('ir.actions.actions').search(
[('name','=',view_name)], 0, 0, 0, context)
if not action_id: return
action_id = rpc.RPCProxy('ir.actions.act_window').search(
[('view_id','=',int(view_id))], context=context)
if not action_id: return ""
domain = ast.literal_eval(domain)
search_domain = ast.literal_eval(search_domain)
domain.extend(search_domain)
domain.extend(ast.literal_eval(search_domain))
action_id = action_id[0]
share_model = 'share.wizard'

View File

@ -26,7 +26,7 @@ class ShareActionEditor(openobject.templating.TemplateEditor):
openobject.http.getURL('/share', {
context: jQuery("#_terp_context").val(),
domain: jQuery("#_terp_domain").val(),
name: jQuery("#_terp_string").val(),
view_id: jQuery("#_terp_view_id").val(),
search_domain: jQuery("#_terp_search_domain").val(),
}));
});