@ -0,0 +1,52 @@ |
|||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0.en.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Odoo rest API |
|||
============= |
|||
* This module allow us to connect to database with REST API requests |
|||
|
|||
Configuration |
|||
----------- |
|||
* Set up the config file |
|||
* Authentication using Postman with login credentials |
|||
* API key generation |
|||
* Communicate with database using API requests |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Lesser General Public License v3.0 (LGPL v3) |
|||
(https://www.gnu.org/licenses/lgpl-3.0.en.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer : (V18) Ayana KP, |
|||
(V16) Yadhushankar, |
|||
(V17) Sruthi pavithran |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
----------- |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding:utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import controllers |
|||
from . import models |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
"name": "Odoo rest API", |
|||
"version": "18.0.1.0.0", |
|||
"category": "Tools", |
|||
"summary": """This app helps to interact with odoo, backend with help of |
|||
rest api requests""", |
|||
"description": """The odoo Rest API module allow us to connect to database |
|||
with the help of GET , POST , PUT and DELETE requests""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
"depends": ['base', 'web'], |
|||
"data": [ |
|||
'security/ir.model.access.csv', |
|||
'views/res_users_views.xml', |
|||
'views/connection_api_views.xml' |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,22 @@ |
|||
# -*- coding:utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import rest_api_odoo |
@ -0,0 +1,239 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
import json |
|||
import logging |
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class RestApi(http.Controller): |
|||
"""This is a controller which is used to generate responses based on the |
|||
api requests""" |
|||
|
|||
def auth_api_key(self, api_key): |
|||
"""This function is used to authenticate the api-key when sending a |
|||
request""" |
|||
user_id = request.env['res.users'].sudo().search([('api_key', '=', api_key)]) |
|||
if api_key is not None and user_id: |
|||
response = True |
|||
elif not user_id: |
|||
response = ('<html><body><h2>Invalid <i>API Key</i> ' |
|||
'!</h2></body></html>') |
|||
else: |
|||
response = ("<html><body><h2>No <i>API Key</i> Provided " |
|||
"!</h2></body></html>") |
|||
return response |
|||
|
|||
def generate_response(self, method, model, rec_id): |
|||
"""This function is used to generate the response based on the type |
|||
of request and the parameters given""" |
|||
option = request.env['connection.api'].search( |
|||
[('model_id', '=', model)], limit=1) |
|||
model_name = option.model_id.model |
|||
if method != 'DELETE': |
|||
data = json.loads(request.httprequest.data) |
|||
else: |
|||
data = {} |
|||
fields = [] |
|||
if data: |
|||
for field in data['fields']: |
|||
fields.append(field) |
|||
if not fields and method != 'DELETE': |
|||
return ("<html><body><h2>No fields selected for the model" |
|||
"</h2></body></html>") |
|||
if not option: |
|||
return ("<html><body><h2>No Record Created for the model" |
|||
"</h2></body></html>") |
|||
try: |
|||
if method == 'GET': |
|||
fields = [] |
|||
for field in data['fields']: |
|||
fields.append(field) |
|||
if not option.is_get: |
|||
return ("<html><body><h2>Method Not Allowed" |
|||
"</h2></body></html>") |
|||
else: |
|||
datas = [] |
|||
if rec_id != 0: |
|||
partner_records = request.env[ |
|||
str(model_name)].search_read( |
|||
domain=[('id', '=', rec_id)], |
|||
fields=fields |
|||
) |
|||
data = json.dumps({ |
|||
'records': partner_records |
|||
}) |
|||
datas.append(data) |
|||
return request.make_response(data=datas) |
|||
else: |
|||
partner_records = request.env[ |
|||
str(model_name)].search_read( |
|||
domain=[], |
|||
fields=fields |
|||
) |
|||
data = json.dumps({ |
|||
'records': partner_records |
|||
}) |
|||
datas.append(data) |
|||
return request.make_response(data=datas) |
|||
except: |
|||
return ("<html><body><h2>Invalid JSON Data" |
|||
"</h2></body></html>") |
|||
if method == 'POST': |
|||
if not option.is_post: |
|||
return ("<html><body><h2>Method Not Allowed" |
|||
"</h2></body></html>") |
|||
else: |
|||
try: |
|||
data = json.loads(request.httprequest.data) |
|||
datas = [] |
|||
new_resource = request.env[str(model_name)].create( |
|||
data['values']) |
|||
partner_records = request.env[ |
|||
str(model_name)].search_read( |
|||
domain=[('id', '=', new_resource.id)], |
|||
fields=fields |
|||
) |
|||
new_data = json.dumps({'New resource': partner_records, }) |
|||
datas.append(new_data) |
|||
return request.make_response(data=datas) |
|||
except: |
|||
return ("<html><body><h2>Invalid JSON Data" |
|||
"</h2></body></html>") |
|||
if method == 'PUT': |
|||
if not option.is_put: |
|||
return ("<html><body><h2>Method Not Allowed" |
|||
"</h2></body></html>") |
|||
else: |
|||
if rec_id == 0: |
|||
return ("<html><body><h2>No ID Provided" |
|||
"</h2></body></html>") |
|||
else: |
|||
resource = request.env[str(model_name)].browse( |
|||
int(rec_id)) |
|||
if not resource.exists(): |
|||
return ("<html><body><h2>Resource not found" |
|||
"</h2></body></html>") |
|||
else: |
|||
try: |
|||
datas = [] |
|||
data = json.loads(request.httprequest.data) |
|||
resource.write(data['values']) |
|||
partner_records = request.env[ |
|||
str(model_name)].search_read( |
|||
domain=[('id', '=', resource.id)], |
|||
fields=fields |
|||
) |
|||
new_data = json.dumps( |
|||
{'Updated resource': partner_records, |
|||
}) |
|||
datas.append(new_data) |
|||
return request.make_response(data=datas) |
|||
|
|||
except: |
|||
return ("<html><body><h2>Invalid JSON Data " |
|||
"!</h2></body></html>") |
|||
if method == 'DELETE': |
|||
if not option.is_delete: |
|||
return ("<html><body><h2>Method Not Allowed" |
|||
"</h2></body></html>") |
|||
else: |
|||
if rec_id == 0: |
|||
return ("<html><body><h2>No ID Provided" |
|||
"</h2></body></html>") |
|||
else: |
|||
resource = request.env[str(model_name)].browse( |
|||
int(rec_id)) |
|||
if not resource.exists(): |
|||
return ("<html><body><h2>Resource not found" |
|||
"</h2></body></html>") |
|||
else: |
|||
|
|||
records = request.env[ |
|||
str(model_name)].search_read( |
|||
domain=[('id', '=', resource.id)], |
|||
fields=['id', 'display_name'] |
|||
) |
|||
remove = json.dumps( |
|||
{"Resource deleted": records, |
|||
}) |
|||
resource.unlink() |
|||
return request.make_response(data=remove) |
|||
|
|||
@http.route(['/send_request'], type='http', |
|||
auth='none', |
|||
methods=['GET', 'POST', 'PUT', 'DELETE'], csrf=False) |
|||
def fetch_data(self, **kw): |
|||
"""This controller will be called when sending a request to the |
|||
specified url, and it will authenticate the api-key and then will |
|||
generate the result""" |
|||
http_method = request.httprequest.method |
|||
api_key = request.httprequest.headers.get('api-key') |
|||
auth_api = self.auth_api_key(api_key) |
|||
model = kw.get('model') |
|||
username = request.httprequest.headers.get('login') |
|||
password = request.httprequest.headers.get('password') |
|||
credential = {'login': username, 'password': password, 'type': 'password'} |
|||
request.session.authenticate(request.session.db, credential) |
|||
model_id = request.env['ir.model'].search( |
|||
[('model', '=', model)]) |
|||
if not model_id: |
|||
return ("<html><body><h3>Invalid model, check spelling or maybe " |
|||
"the related " |
|||
"module is not installed" |
|||
"</h3></body></html>") |
|||
|
|||
if auth_api == True: |
|||
if not kw.get('Id'): |
|||
rec_id = 0 |
|||
else: |
|||
rec_id = int(kw.get('Id')) |
|||
result = self.generate_response(http_method, model_id.id, rec_id) |
|||
return result |
|||
else: |
|||
return auth_api |
|||
|
|||
@http.route(['/odoo_connect'], type="http", auth="none", csrf=False, |
|||
methods=['GET']) |
|||
def odoo_connect(self, **kw): |
|||
"""This is the controller which initializes the api transaction by |
|||
generating the api-key for specific user and database""" |
|||
username = request.httprequest.headers.get('login') |
|||
password = request.httprequest.headers.get('password') |
|||
db = request.httprequest.headers.get('db') |
|||
try: |
|||
request.session.update(http.get_default_session(), db=db) |
|||
credential = {'login': username, 'password': password, |
|||
'type': 'password'} |
|||
|
|||
auth = request.session.authenticate(db, credential) |
|||
user = request.env['res.users'].browse(auth['uid']) |
|||
api_key = request.env.user.generate_api(username) |
|||
datas = json.dumps({"Status": "auth successful", |
|||
"User": user.name, |
|||
"api-key": api_key}) |
|||
return request.make_response(data=datas) |
|||
except: |
|||
return ("<html><body><h2>wrong login credentials" |
|||
"</h2></body></html>") |
@ -0,0 +1,5 @@ |
|||
## Module <rest_api_odoo> |
|||
|
|||
#### 02.12.2024 |
|||
#### Version 18.0.1.0.0 |
|||
- Initial Commit for Odoo rest API |
@ -0,0 +1,23 @@ |
|||
# -*- coding:utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import connection_api |
|||
from . import res_users |
@ -0,0 +1,47 @@ |
|||
# -*- coding:utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ConnectionApi(models.Model): |
|||
"""This class is used to create an api model in which we can create |
|||
records with models and fields, and also we can specify methods.""" |
|||
_name = 'connection.api' |
|||
_description = 'Connection Rest Api' |
|||
_rec_name = 'model_id' |
|||
|
|||
model_id = fields.Many2one('ir.model', string="Model", |
|||
domain="[('transient', '=', False)]", |
|||
help="Select model which can be accessed by " |
|||
"REST api requests.") |
|||
is_get = fields.Boolean(string='GET', |
|||
help="Select this to enable GET method " |
|||
"while sending requests.") |
|||
is_post = fields.Boolean(string='POST', |
|||
help="Select this to enable POST method" |
|||
"while sending requests.") |
|||
is_put = fields.Boolean(string='PUT', |
|||
help="Select this to enable PUT method " |
|||
"while sending requests.") |
|||
is_delete = fields.Boolean(string='DELETE', |
|||
help="Select this to enable DELETE method " |
|||
"while sending requests.") |
@ -0,0 +1,44 @@ |
|||
# -*- coding:utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
import uuid |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResUsers(models.Model): |
|||
"""This class is used to inherit users and add api key generation""" |
|||
_inherit = 'res.users' |
|||
|
|||
api_key = fields.Char(string="API Key", readonly=True, |
|||
help="Api key for connecting with the " |
|||
"Database.The key will be " |
|||
"generated when authenticating " |
|||
"rest api.") |
|||
|
|||
def generate_api(self, username): |
|||
"""This function is used to generate api-key for each user""" |
|||
users = self.env['res.users'].sudo().search([('login', '=', username)]) |
|||
if not users.api_key: |
|||
users.api_key = str(uuid.uuid4()) |
|||
key = users.api_key |
|||
else: |
|||
key = users.api_key |
|||
return key |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,61 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Form view for 'connection.api' model. --> |
|||
<record id="connection_api_view_form" model="ir.ui.view"> |
|||
<field name="name">connection.api.view.form</field> |
|||
<field name="model">connection.api</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<sheet> |
|||
<group> |
|||
<group string="Resource"> |
|||
<field name="model_id" string="Model"/> |
|||
</group> |
|||
<group string="Methods"> |
|||
<field name="is_get"/> |
|||
<field name="is_post"/> |
|||
<field name="is_put"/> |
|||
<field name="is_delete"/> |
|||
</group> |
|||
</group> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!-- List view for 'connection.api' model. --> |
|||
<record id="connection_api_view_list" model="ir.ui.view"> |
|||
<field name="name">connection.api.view.list</field> |
|||
<field name="model">connection.api</field> |
|||
<field name="arch" type="xml"> |
|||
<list> |
|||
<field name="model_id" string="Model"/> |
|||
<field name="is_get"/> |
|||
<field name="is_post"/> |
|||
<field name="is_put"/> |
|||
<field name="is_delete"/> |
|||
</list> |
|||
</field> |
|||
</record> |
|||
<!-- Action for 'connection.api' model with List and form views. --> |
|||
<record id="rest_api_root_action" model="ir.actions.act_window"> |
|||
<field name="name">Rest API Records</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">connection.api</field> |
|||
<field name="view_mode">list,form</field> |
|||
<field name="help" type="html"> |
|||
<p class="o_view_nocontent_smiling_face"> |
|||
Create! |
|||
</p> |
|||
</field> |
|||
</record> |
|||
<!-- Menu items for the REST API. --> |
|||
<menuitem id="rest_api_root" |
|||
name="Rest API" |
|||
sequence="10" |
|||
web_icon="rest_api_odoo,static/description/icon.png"/> |
|||
<menuitem id="rest_api_details_root" |
|||
name="Rest API" |
|||
parent="rest_api_root" |
|||
action="rest_api_root_action" |
|||
sequence="10"/> |
|||
</odoo> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Inherited user view for Adding API key. --> |
|||
<record id="view_users_form" model="ir.ui.view"> |
|||
<field name="name">view.users.form.inherit.rest.api.odoo</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="model">res.users</field> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//page[@name='access_rights']" position="after"> |
|||
<page string="API" name="rest-api"> |
|||
<group> |
|||
<field name="api_key" groups="base.group_user"/> |
|||
</group> |
|||
</page> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |