~sebastien.beau/openobject-addons/period_id_optionnal_on_bank_statement

« back to all changes in this revision

Viewing changes to share/static/src/js/share.js

  • Committer: Olivier Dony
  • Date: 2011-12-14 17:35:29 UTC
  • Revision ID: odo@openerp.com-20111214173529-4mge3sgcw2thn3at
[FIX] share: evaluate domain client-side before passing to share wizard

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
function launch_wizard(self, view) {
5
5
        var action = view.widget_parent.action;
6
6
        var Share = new instance.web.DataSet(self, 'share.wizard', view.dataset.get_context());
7
 
        var domain = view.dataset.domain;
8
 
 
 
7
        var domain = new instance.web.CompoundDomain(view.dataset.domain);
9
8
        if (view.fields_view.type == 'form') {
10
9
            domain = new instance.web.CompoundDomain(domain, [['id', '=', view.datarecord.id]]);
11
10
        }
12
 
 
13
 
        Share.create({
14
 
            name: action.name,
15
 
            domain: domain,
16
 
            action_id: action.id,
17
 
        }, function(result) {
18
 
            var share_id = result.result;
19
 
            var step1 = Share.call('go_step_1', [[share_id],], function(result) {
20
 
                var action = result;
21
 
                self.do_action(action);
 
11
        self.rpc('/web/session/eval_domain_and_context', {
 
12
            domains: [domain],
 
13
            contexts: [view.dataset.context]
 
14
        }, function (result) {
 
15
            Share.create({
 
16
                name: action.name,
 
17
                domain: result.domain,
 
18
                action_id: action.id,
 
19
            }, function(result) {
 
20
                var share_id = result.result;
 
21
                var step1 = Share.call('go_step_1', [[share_id],], function(result) {
 
22
                    var action = result;
 
23
                    self.do_action(action);
 
24
                });
22
25
            });
23
26
        });
24
27
}