~txerpa-openerp/openobject-client-web/txerpa

« back to all changes in this revision

Viewing changes to addons/openerp/controllers/actions.py

  • Committer: Biel - txerpa.com
  • Date: 2013-08-09 12:30:58 UTC
  • mfrom: (4670.2.245 openobject-client-web)
  • Revision ID: biel.massot@txerpa.com-20130809123058-892zu673ti1j8yjd
Actualizo a la ultima revision de trunk. Hay muchos bugs correjidos desde 2012. Elimino la revision 4873 por problemas de rendimiento en el dashboard de Contabilidad

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
        report_id = rpc.session.execute('report', 'report', name, ids, datas, ctx)
162
162
        state = False
163
163
        attempt = 0
 
164
        max_attempt = cherrypy.config.get('openerp.server.timeout') or 200
164
165
        val = None
165
166
        while not state:
166
167
            val = rpc.session.execute('report', 'report_get', report_id)
170
171
            if not state:
171
172
                time.sleep(1)
172
173
                attempt += 1
173
 
            if attempt>200:
 
174
            if attempt>max_attempt:
174
175
                raise common.message(_('Printing aborted, too long delay'))
175
176
 
176
177
        # report name
312
313
def act_url(action, data):
313
314
    return execute_url(**dict(data,
314
315
        url=action['url'],
315
 
        target=action['target'],
 
316
        target=action.get('target','new'),
316
317
        type=action['type']
317
318
    ))
318
319
 
350
351
            cherrypy.response.headers['active_id'] = cherrypy.request.params.get('_terp_id')\
351
352
            or cherrypy.request.params.context.get('active_id')
352
353
 
 
354
    # when action 'open a new tab', make sure we follow 'nodestroy' flag, if set.
 
355
    no_destroy = (action.get('nodestroy') and open_new_tab) and 'true' or 'false'
 
356
 
353
357
    # Add 'opened' mark to indicate we're now within the popup and can
354
358
    # continue on during the second round of execution
355
359
    payload = str({
370
374
        url = '/?' + urllib.urlencode({'next': url})
371
375
        
372
376
    cherrypy.response.headers['X-Target'] = action['target']
 
377
    cherrypy.response.headers['X-No-Destroy'] = no_destroy
373
378
    cherrypy.response.headers['Location'] = url
374
379
    return """<script type="text/javascript">
375
 
        window.top.openAction('%s', '%s');
 
380
        window.top.openAction('%s', '%s', false, %s);
376
381
    </script>
377
 
    """ % (url, action['target'])
 
382
    """ % (url, action['target'], no_destroy)
378
383
 
379
384
def execute(action, **data):
380
385
    """Execute the action with the provided data. for internal use only.
406
411
        # determine target for openAction()
407
412
        target = {'new': 'popup'}.get(data['target'], 'iframe')
408
413
 
 
414
        cherrypy.response.headers['X-Target'] = target
 
415
        cherrypy.response.headers['Location'] = url
 
416
 
409
417
        return """<script type="text/javascript">
410
418
                      openAction('%s', '%s')
411
419
                  </script>