File tree 1 file changed +20
-9
lines changed
1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 6
6
7
7
from apispec import APISpec
8
8
9
+ from odoo .http import request
10
+
9
11
from ..core import _rest_services_databases
10
12
from ..tools import ROUTING_DECORATOR_ATTR
11
13
from .rest_method_param_plugin import RestMethodParamPlugin
@@ -42,15 +44,24 @@ def _get_servers(self):
42
44
if spec ["collection_name" ] == self ._service ._collection :
43
45
collection_path = path
44
46
break
45
- base_url = env ["ir.config_parameter" ].sudo ().get_param ("web.base.url" )
46
- return [
47
- {
48
- "url" : (
49
- f"{ base_url .strip ('/' )} /{ collection_path .strip ('/' )} "
50
- f"/{ self ._service ._usage } "
51
- )
52
- }
53
- ]
47
+ base_domain = (
48
+ env ["ir.config_parameter" ].sudo ().get_param ("web.base.url" ).strip ("/" )
49
+ )
50
+ current_domain = request .httprequest .url_root .strip ("/" )
51
+ domains = [base_domain ]
52
+ if base_domain != current_domain :
53
+ domains .append (current_domain )
54
+ res = []
55
+ for domain in domains :
56
+ res .append (
57
+ {
58
+ "url" : "/" .join (
59
+ [domain , collection_path .strip ("/" ), self ._service ._usage ]
60
+ )
61
+ }
62
+ )
63
+
64
+ return res
54
65
55
66
def _get_plugins (self ):
56
67
return [
You can’t perform that action at this time.
0 commit comments