mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 14:31:59 +02:00
Add 19 payment provider modules needed by the sale module:
payment_adyen, payment_aps, payment_asiapay, payment_authorize,
payment_buckaroo, payment_demo, payment_dpo, payment_flutterwave,
payment_iyzico, payment_mercado_pago, payment_mollie, payment_nuvei,
payment_paymob, payment_paypal, payment_razorpay, payment_redsys,
payment_stripe, payment_worldline, payment_xendit
Add 3 IoT modules needed for point_of_sale:
iot_base, iot_box_image, iot_drivers
Note: Stripe test API keys replaced with placeholders.
🤖 assisted by claude
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import collections
|
|
import odoo.http
|
|
|
|
from odoo.http import JsonRPCDispatcher, serialize_exception
|
|
from odoo.addons.iot_drivers.tools.system import IS_TEST
|
|
from werkzeug.exceptions import Forbidden
|
|
|
|
|
|
class JsonRPCDispatcherPatch(JsonRPCDispatcher):
|
|
def handle_error(self, exc: Exception) -> collections.abc.Callable:
|
|
"""Monkey patch the handle_error method to add HTTP 403 Forbidden
|
|
error handling.
|
|
|
|
:param exc: the exception that occurred.
|
|
:returns: a WSGI application
|
|
"""
|
|
error = {
|
|
'code': 200, # this code is the JSON-RPC level code, it is
|
|
# distinct from the HTTP status code. This
|
|
# code is ignored and the value 200 (while
|
|
# misleading) is totally arbitrary.
|
|
'message': "Odoo Server Error",
|
|
'data': serialize_exception(exc),
|
|
}
|
|
if isinstance(exc, Forbidden):
|
|
error['code'] = 403
|
|
error['message'] = "403: Forbidden"
|
|
error['data'] = {"message": error['data']["message"]} # only keep the message, not the traceback
|
|
|
|
return self._response(error=error)
|
|
|
|
|
|
if not IS_TEST:
|
|
# Test IoT system is expected to handle Odoo database unlike "real" IoT systems.
|
|
|
|
def db_list(force=False, host=None):
|
|
return []
|
|
|
|
odoo.http.db_list = db_list
|