title: Odoo: Call self.env or another model in Thread
body: <p>In odoo 10, I have a thread calling a method that uses self.env to call a model. But when the system does not let me occupy this and throws an exception like this:</p>
  
  <pre><code>Exception in thread Thread-44:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
  self.run()
    File "/usr/lib/python2.7/threading.py", line 754, in run
  self.__target(*self.__args, **self.__kwargs)
    File "/home/kunder/proyectos/odoo/addons/kunder_odoo_comercionet/models/models.py", line 97, in update_quotations_thread
  quotation_list = self.download_comercionet_docs();
    File "/home/kunder/proyectos/odoo/addons/kunder_odoo_comercionet/models/models.py", line 370, in download_comercionet_docs
  new_last_date_db = (self.env["ftp_orders.settings"]).search([])[0].last_date
    File "/home/kunder/proyectos/odoo/odoo/models.py", line 1508, in search
  res = self._search(args, offset=offset, limit=limit, order=order, count=count)
    File "/home/kunder/proyectos/odoo/odoo/models.py", line 4193, in _search
  self.sudo(access_rights_uid or self._uid).check_access_rights('read')
    File "/home/kunder/proyectos/odoo/odoo/models.py", line 4842, in sudo
  return self.with_env(self.env(user=user))
    File "/home/kunder/proyectos/odoo/odoo/api.py", line 781, in __call__
  return Environment(cr, uid, context)
    File "/home/kunder/proyectos/odoo/odoo/api.py", line 726, in __new__
  env, envs = None, cls.envs
    File "/home/kunder/proyectos/odoo/odoo/tools/func.py", line 111, in __get__
  return self.fget.__get__(None, owner)()
    File "/home/kunder/proyectos/odoo/odoo/api.py", line 699, in envs
  return cls._local.environments
    File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 72, in __getattr__
      raise AttributeError(name)
    AttributeError: environments
  </code></pre>
  
  <p>I handle the thread in a model and the way I handle the thread is:</p>
  
  <pre><code>def thread_method(self):
       #This method call other model like this and do some other stuff
       self.env['sale.order'].search([])
  def main_method(self):
       threading.Thread(target = self.method_thread).start()
  </code></pre>
  
  <p>I'm debugging the code and if I seat on the main_method, it have the same object self.env that have the thread_method, so I do not understand why it does not works.</p>
  
  <p>How can i request another model in a thread?</p>
  
  <p>Thanks</p>