Blame view

web/js/script.js 876 Bytes
714f42c5   Yarik   Odoo completed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  $(function() {
      $(document)
          .on('click', '.odoo-import-product, .odoo-import-order', function(e) {
              e.preventDefault();
              var url = $(this)
                  .data('url');
              postData(url, 0, 100);
          });
  });
  function postData(url, from, limit) {
      $.post(url + '?from=' + from + '&limit=' + limit, function(data) {
          show(data.percent);
          if (!data.end) {
              postData(url, from + limit, limit);
          }
      });
  }
  function show(percent) {
      var odoo_progress = $('#odoo-progress');
      var progress_bar = odoo_progress.find('.progress-bar')
                                      .first();
      progress_bar.width(percent + '%');
      progress_bar.attr('aria-valuenow', percent);
      if (percent < 100) {
          progress_bar.addClass('active');
      } else {
          progress_bar.removeClass('active');
      }
  }