~ubuntu-branches/ubuntu/trusty/openerp-client/trusty

« back to all changes in this revision

Viewing changes to bin/modules/action/main.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2010-05-07 14:27:48 UTC
  • mfrom: (1.3.1 upstream) (12.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100507142748-jzko6vxggw8czdmq
Tags: 5.0.10-1
* Adding python-tz to recommends.
* Merging upstream version 5.0.10.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import printer
31
31
import common
32
32
import tools
 
33
import options
33
34
from widget.view.form_gtk.many2one import dialog
34
35
 
35
36
class main(service.Service):
51
52
        report_id = rpc.session.rpc_exec_auth('/report', 'report', name, ids, datas, ctx)
52
53
        state = False
53
54
        attempt = 0
 
55
        max_attemps = int(options.options.get('client.timeout') or 0)
54
56
        while not state:
55
57
            val = rpc.session.rpc_exec_auth('/report', 'report_get', report_id)
56
58
            if not val:
59
61
            if not state:
60
62
                time.sleep(1)
61
63
                attempt += 1
62
 
            if attempt>200:
 
64
            if attempt>max_attemps:
63
65
                common.message(_('Printing aborted, too long delay !'))
64
66
                return False
65
67
        printer.print_data(val)
132
134
            ctx.update({'active_id': datas.get('id',False), 'active_ids': datas.get('ids',[])})
133
135
            res = rpc.session.rpc_exec_auth('/object', 'execute', 'ir.actions.server', 'run', [action['id']], ctx)
134
136
            if res:
135
 
                self._exec_action(res, datas, context)
 
137
                if not isinstance(res, list):
 
138
                    res = [res]
 
139
                for r in res:
 
140
                    self._exec_action(r, datas, context)
136
141
 
137
142
        elif action['type']=='ir.actions.wizard':
138
143
            win=None