[FIX] share: evaluate domain client-side before passing to share wizard

lp bug: https://launchpad.net/bugs/902106 fixed

bzr revid: odo@openerp.com-20111214173529-4mge3sgcw2thn3at
This commit is contained in:
Olivier Dony 2011-12-14 18:35:29 +01:00
parent d1ddc1ee78
commit 5c817b0887
1 changed files with 15 additions and 12 deletions

View File

@ -4,21 +4,24 @@ openerp.share = function(instance) {
function launch_wizard(self, view) {
var action = view.widget_parent.action;
var Share = new instance.web.DataSet(self, 'share.wizard', view.dataset.get_context());
var domain = view.dataset.domain;
var domain = new instance.web.CompoundDomain(view.dataset.domain);
if (view.fields_view.type == 'form') {
domain = new instance.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]);
}
Share.create({
name: action.name,
domain: domain,
action_id: action.id,
}, function(result) {
var share_id = result.result;
var step1 = Share.call('go_step_1', [[share_id],], function(result) {
var action = result;
self.do_action(action);
self.rpc('/web/session/eval_domain_and_context', {
domains: [domain],
contexts: [view.dataset.context]
}, function (result) {
Share.create({
name: action.name,
domain: result.domain,
action_id: action.id,
}, function(result) {
var share_id = result.result;
var step1 = Share.call('go_step_1', [[share_id],], function(result) {
var action = result;
self.do_action(action);
});
});
});
}