Skip to content

Commit 5ccd5f6

Browse files
committed
[ADD] webservice_server_env: make server_environment an optional dependency
1 parent ac6d9cc commit 5ccd5f6

File tree

14 files changed

+668
-0
lines changed

14 files changed

+668
-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: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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/18.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-18-0/web-api-18-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=18.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
32+
Webservice addon.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Bug Tracker
40+
===========
41+
42+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web-api/issues>`_.
43+
In case of trouble, please check there if your issue has already been reported.
44+
If you spotted it first, help us to smash it by providing a detailed and welcomed
45+
`feedback <https://github.com/OCA/web-api/issues/new?body=module:%20webservice_server_env%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
46+
47+
Do not contact contributors directly about support or help with technical issues.
48+
49+
Credits
50+
=======
51+
52+
Authors
53+
-------
54+
55+
* Creu Blanca
56+
* Camptocamp
57+
58+
Contributors
59+
------------
60+
61+
- Enric Tobella <etobella@creublanca.es>
62+
- Daniel Reis <dreis@opensourceintegrators.com>
63+
64+
Maintainers
65+
-----------
66+
67+
This module is maintained by the OCA.
68+
69+
.. image:: https://odoo-community.org/logo.png
70+
:alt: Odoo Community Association
71+
:target: https://odoo-community.org
72+
73+
OCA, or the Odoo Community Association, is a nonprofit organization whose
74+
mission is to support the collaborative development of Odoo features and
75+
promote its widespread use.
76+
77+
.. |maintainer-etobella| image:: https://github.com/etobella.png?size=40px
78+
:target: https://github.com/etobella
79+
:alt: etobella
80+
81+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
82+
83+
|maintainer-etobella|
84+
85+
This module is part of the `OCA/web-api <https://github.com/OCA/web-api/tree/18.0/webservice_server_env>`_ project on GitHub.
86+
87+
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 <simahawk@gmail.com>
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 <simahawk@gmail.com>
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Enric Tobella \<<etobella@creublanca.es>\>
2+
- Daniel Reis \<<dreis@opensourceintegrators.com>\>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Glue module to make Server Environment features available for the
2+
Webservice addon.

0 commit comments

Comments
 (0)