17 lines
478 B

  1. # Copyright 2018 Creu Blanca
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import models
  4. from threading import current_thread
  5. class Base(models.AbstractModel):
  6. _inherit = 'base'
  7. @property
  8. def remote(self):
  9. try:
  10. remote_addr = current_thread().environ["REMOTE_ADDR"]
  11. except (KeyError, AttributeError):
  12. return self.env['res.remote']
  13. return self.env['res.remote']._get_remote(remote_addr)