payment_provider.py 560 B

123456789101112131415161718192021
  1. # coding: utf-8
  2. from odoo import fields, models
  3. from odoo.http import request
  4. class PaymentProvider(models.Model):
  5. _inherit = "payment.provider"
  6. website_id = fields.Many2one(
  7. "website",
  8. domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",
  9. ondelete="restrict",
  10. )
  11. def get_base_url(self):
  12. # Give priority to url_root to handle multi-website cases
  13. if request and request.httprequest.url_root:
  14. return request.httprequest.url_root
  15. return super().get_base_url()