~jfb-tempo-consulting/unifield-web/US-7530

« back to all changes in this revision

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

  • Committer: jf
  • Date: 2020-08-06 14:23:27 UTC
  • mfrom: (4989.2.5 web-US-5271)
  • Revision ID: jfb@tempo-consulting.fr-20200806142327-fy0fvg6ud982dxu7
US-5271 [IMP] new attr set_ids on button to retrieve the o2m ids
Refresh o2m in a 1st popup when the 2nd popup is closed

lp:~jfb-tempo-consulting/unifield-web/US-5271

Show diffs side-by-side

added added

removed removed

Lines of Context:
270
270
def act_window_close(action=False, *args, **b):
271
271
    return close_popup(o2m_refresh=action.get('o2m_refresh'))
272
272
 
 
273
def refresh_popupo2m(action=False, *args, **b):
 
274
    return close_popup(o2m_refresh=action.get('o2m_refresh'), frompopup=True)
 
275
 
273
276
def refresh_o2m(action=False, *a, **b):
274
277
    cherrypy.response.headers['Content-Type'] = 'text/javascript'
275
278
    import json
408
411
                              ))
409
412
 
410
413
ACTIONS_BY_TYPE = {
 
414
    'ir.actions.refresh_popupo2m': refresh_popupo2m,
411
415
    'ir.actions.refresh_o2m': refresh_o2m,
412
416
    'ir.actions.act_window_close': act_window_close,
413
417
    'ir.actions.act_window': act_window,
590
594
 
591
595
 
592
596
@tools.expose(template="/openerp/controllers/templates/closepopup.mako")
593
 
def close_popup(reload=True, o2m_refresh=False):
 
597
def close_popup(reload=True, o2m_refresh=False, frompopup=False):
594
598
    """ Closes an opened dialog box or popup.
595
599
 
596
600
    :param reload: whether the background view should be reloaded when closing the popup
603
607
    if getattr(cherrypy.request, 'params', []):
604
608
        if getattr(cherrypy.request.params, 'context', {}):
605
609
            active_id = cherrypy.request.params.context.get('active_id')
606
 
    return {'reload': reload, 'active_id': active_id, 'o2m_refresh': o2m_refresh}
 
610
    return {'reload': reload, 'active_id': active_id, 'o2m_refresh': o2m_refresh, 'frompopup': frompopup}
607
611
 
608
612
@tools.expose(template="/openerp/controllers/templates/report.mako")
609
613
def report_link(report_name, **kw):