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

« back to all changes in this revision

Viewing changes to addons/openerp/controllers/templates/downloadbg.mako

  • Committer: jf
  • Date: 2019-10-17 14:17:46 UTC
  • mfrom: (4973.1.2 unifield-web)
  • Revision ID: jfb@tempo-consulting.fr-20191017141746-5xxs9rtmi7bufl75
US-5831 [IMP] Background report: button to stop the report

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
    <script type="text/javascript">
6
6
        if ('${total}' != 'True' && '${finish}' == '') {
7
7
            setTimeout(function () {window.location.reload();}, 3000);
8
 
        }
 
8
            //$(window).bind("beforeunload", kill_report);
 
9
            //setTimeout(function () {$(window).unbind("beforeunload"); window.location.reload();}, 3000);
 
10
        }
 
11
 
 
12
        function kill_report() {
 
13
            jQuery.ajax({
 
14
                url:'/openerp/downloadbg/kill',
 
15
                dataType: 'json',
 
16
                type: 'POST',
 
17
                data: {
 
18
                    'res_id': ${res_id}
 
19
                },
 
20
                success: function(obj) {
 
21
                    if (obj.result && obj.result['res']) {
 
22
                        window.close();
 
23
                    } else {
 
24
                        msg = obj.result['msg'];
 
25
                        alert(_("Report can not be stopped :") + msg);
 
26
                    }
 
27
                }
 
28
            });
 
29
        }
 
30
 
9
31
    </script>
10
32
    <style>
11
33
        #downloadbg-form {
86
108
    %endif
87
109
    %if data_collected != 'True' and total != 'True':
88
110
        <div id="explanations">${_('A button to download the report will be displayed when finished.')}</div>
 
111
        <div id="explanations"><button onclick="kill_report()" class="oe_form_button_object"><img src="/openerp/static/images/stock/gtk-cancel.png" alt="" height="16" width="16"/><span> ${_('Stop report')} </span></button></div>
89
112
    %endif
90
113
    <div id="report_name">${_('Name of the requested report: ')}${report_name}
91
114
    %if total == 'True':