Skip to content

Commit 62ea7a3

Browse files
committed
[ADD] webservice_server_env: make server_environment an optional dependency
1 parent 8dda582 commit 62ea7a3

File tree

13 files changed

+660
-0
lines changed

13 files changed

+660
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../webservice_server_env
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

webservice_server_env/README.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
=============================
2+
WebService Server Environment
3+
=============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:3259abecb5f2052be5402be6eaa2e4a70ee6d401a3b9e1d6fd58499b13c36099
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github
20+
:target: https://github.com/OCA/web-api/tree/16.0/webservice_server_env
21+
:alt: OCA/web-api
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/web-api-16-0/web-api-16-0-webservice_server_env
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Glue module to make Server Environment features available for the Webservice addon.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Bug Tracker
39+
===========
40+
41+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web-api/issues>`_.
42+
In case of trouble, please check there if your issue has already been reported.
43+
If you spotted it first, help us to smash it by providing a detailed and welcomed
44+
`feedback <https://github.com/OCA/web-api/issues/new?body=module:%20webservice_server_env%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
45+
46+
Do not contact contributors directly about support or help with technical issues.
47+
48+
Credits
49+
=======
50+
51+
Authors
52+
~~~~~~~
53+
54+
* Creu Blanca
55+
* Camptocamp
56+
57+
Contributors
58+
~~~~~~~~~~~~
59+
60+
* Enric Tobella <[email protected]>
61+
* Daniel Reis <[email protected]>
62+
63+
Maintainers
64+
~~~~~~~~~~~
65+
66+
This module is maintained by the OCA.
67+
68+
.. image:: https://odoo-community.org/logo.png
69+
:alt: Odoo Community Association
70+
:target: https://odoo-community.org
71+
72+
OCA, or the Odoo Community Association, is a nonprofit organization whose
73+
mission is to support the collaborative development of Odoo features and
74+
promote its widespread use.
75+
76+
.. |maintainer-etobella| image:: https://github.com/etobella.png?size=40px
77+
:target: https://github.com/etobella
78+
:alt: etobella
79+
80+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
81+
82+
|maintainer-etobella|
83+
84+
This module is part of the `OCA/web-api <https://github.com/OCA/web-api/tree/16.0/webservice_server_env>`_ project on GitHub.
85+
86+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

webservice_server_env/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2020 Creu Blanca
2+
# Copyright 2022 Camptocamp SA
3+
# @author Simone Orsi <[email protected]>
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
5+
6+
7+
{
8+
"name": "WebService Server Environment",
9+
"summary": "Use Server Environment feature to manage Webservice configs",
10+
"version": "18.0.1.0.0",
11+
"license": "AGPL-3",
12+
"development_status": "Production/Stable",
13+
"maintainers": ["etobella"],
14+
"author": "Creu Blanca, Camptocamp, Odoo Community Association (OCA)",
15+
"website": "https://github.com/OCA/web-api",
16+
"depends": ["webservice", "server_environment"],
17+
"auto_install": True,
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import webservice_backend
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2020 Creu Blanca
2+
# Copyright 2022 Camptocamp SA
3+
# @author Simone Orsi <[email protected]>
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
5+
6+
from odoo import models
7+
8+
9+
class WebserviceBackend(models.Model):
10+
_name = "webservice.backend"
11+
_inherit = ["webservice.backend", "server.env.techname.mixin", "server.env.mixin"]
12+
13+
@property
14+
def _server_env_fields(self):
15+
base_fields = super()._server_env_fields
16+
webservice_fields = {
17+
"protocol": {},
18+
"url": {},
19+
"auth_type": {},
20+
"username": {},
21+
"password": {},
22+
"api_key": {},
23+
"api_key_header": {},
24+
"content_type": {},
25+
"oauth2_flow": {},
26+
"oauth2_scope": {},
27+
"oauth2_clientid": {},
28+
"oauth2_client_secret": {},
29+
"oauth2_authorization_url": {},
30+
"oauth2_token_url": {},
31+
"oauth2_audience": {},
32+
}
33+
webservice_fields.update(base_fields)
34+
return webservice_fields
35+
36+
def _compute_server_env(self):
37+
# OVERRIDE: reset ``oauth2_flow`` when ``auth_type`` is not "oauth2", even if
38+
# defined otherwise in server env vars
39+
res = super()._compute_server_env()
40+
self.filtered(lambda r: r.auth_type != "oauth2").oauth2_flow = None
41+
return res
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Enric Tobella <[email protected]>
2+
* Daniel Reis <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Glue module to make Server Environment features available for the Webservice addon.
9.23 KB
Loading

0 commit comments

Comments
 (0)