docs: def download(self, filename, timeout=3600, action=None, query=None,
                   fields_convert_map=None, type=None, domain=None,
                   template_filename='', sheet_name='', **kwargs):
          """
          Default domain option is PARA/DOMAIN
          :param template_filename: Excel template filename, it'll xltools to writer it, only can be used
              in xlsx
          """
          from uliweb import settings
          
          fields_convert_map = fields_convert_map or self.fields_convert_map
          
          t_filename = self.get_real_file(filename)
          if os.path.exists(t_filename):
              if timeout and os.path.getmtime(t_filename) + timeout > time.time():
                  return self.downloader.download(filename, action)
              
          if query is None:
              query = self.query_all()
          if not type:
              type = os.path.splitext(filename)[1]
              if type:
                  type = type[1:]
              else:
                  type = 'csv'
          if type in ('xlt', 'xls'):
              if not domain:
                  domain = settings.get_var('PARA/DOMAIN')
              return self.download_xlt(filename, query, action, fields_convert_map, domain, not_tempfile=bool(timeout), **kwargs)
          if type in ('xlsx',):
              if not domain:
                  domain = settings.get_var('PARA/DOMAIN')
              return self.download_xlsx(filename, query, action, fields_convert_map, domain,
                                        not_tempfile=bool(timeout), template_filename=template_filename,
                                        sheet_name=sheet_name, **kwargs)
          else:
              return self.download_csv(filename, query, action, fields_convert_map, not_tempfile=bool(timeout), **kwargs)