Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet

I have created an API for creating a ticket. I just started working on it.

I am getting an error. When I access the API I select the related database and in that database, if my module is installed then I get the response. 
But If I open the URL in incognito mode of the browser then It gives me the error. because the database is not selected by default in incognito mode


Here is the code of the controller file

from odoo import http
from odoo.http import request
import json


class MetaWithHelpdesk(http.Controller):

@http.route('/api/create_ticket', type='http', auth='public', methods=['POST', 'GET'], csrf=False)
def create_ticket(self, **kw):
print('reached')
try:
return json.dumps({'message': 'Ticket created successfully'})
except Exception as e:
return json.dumps({'error': str(e)})


here is the code of __manifest__.py

# -*- coding: utf-8 -*-
{
'name': "Helpdesk Ticket",

'summary': """
Helpdesk Ticket"""
,

'description': """
Helpdesk Ticket
"""
,

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'helpdesk',
'version': '16.0.1',

# any module necessary for this one to work correctly
'depends': ['base', 'web'],
'auto_install': True,
'bootstrap': True, # load translations for login screen,
'license': 'LGPL-3',
# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
],
}



Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Sept. 23
2471
0
Juni 22
3008
3
Mai 21
13758
2
Dez. 24
2163
1
Aug. 24
2244