summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/patch/__pycache__
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-05 10:51:52 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-05 10:51:52 +0700
commitfc6d38599b405820b3c266a31ef21a3a0f3f0a73 (patch)
tree97cbc4bb913f76651ae9cc774b7a9f716bae8167 /indoteknik_custom/models/patch/__pycache__
parentd9ddc88ea00a5c86c7cf82552970ab0c917d8544 (diff)
(andri) fix
Diffstat (limited to 'indoteknik_custom/models/patch/__pycache__')
-rw-r--r--indoteknik_custom/models/patch/__pycache__/__init__.py1
-rw-r--r--indoteknik_custom/models/patch/__pycache__/http_override.py46
2 files changed, 0 insertions, 47 deletions
diff --git a/indoteknik_custom/models/patch/__pycache__/__init__.py b/indoteknik_custom/models/patch/__pycache__/__init__.py
deleted file mode 100644
index 051b6537..00000000
--- a/indoteknik_custom/models/patch/__pycache__/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from . import http_override \ No newline at end of file
diff --git a/indoteknik_custom/models/patch/__pycache__/http_override.py b/indoteknik_custom/models/patch/__pycache__/http_override.py
deleted file mode 100644
index e1978edb..00000000
--- a/indoteknik_custom/models/patch/__pycache__/http_override.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-import odoo.http
-import json
-import logging
-from werkzeug.exceptions import BadRequest
-import functools
-
-_logger = logging.getLogger(__name__)
-
-class CustomJsonRequest(odoo.http.JsonRequest):
- def __init__(self, httprequest):
- super(odoo.http.JsonRequest, self).__init__(httprequest)
-
- self.params = {}
- request_data_raw = self.httprequest.get_data().decode(self.httprequest.charset)
-
- self.jsonrequest = {}
- if request_data_raw.strip():
- try:
- self.jsonrequest = json.loads(request_data_raw)
- except ValueError:
- msg = 'Invalid JSON data: %r' % (request_data_raw,)
- _logger.info('%s: %s (Handled by CustomJsonRequest)', self.httprequest.path, msg)
- raise BadRequest(msg)
- else:
- _logger.info("CustomJsonRequest: Received empty or whitespace-only JSON body. Treating as empty JSON for webhook.")
-
- self.params = dict(self.jsonrequest.get("params", {}))
- self.context = self.params.pop('context', dict(self.session.context))
-
-
-_original_get_request = odoo.http.Root.get_request
-
-@functools.wraps(_original_get_request)
-def _get_request_override(self, httprequest):
- _logger.info("--- DEBUG: !!! _get_request_override IS CALLED !!! ---")
- _logger.info(f"--- DEBUG: Request Mimetype: {httprequest.mimetype}, Path: {httprequest.path} ---")
-
- if httprequest.mimetype in ("application/json", "application/json-rpc"):
- _logger.debug("Odoo HTTP: Using CustomJsonRequest for mimetype: %s", httprequest.mimetype)
- return CustomJsonRequest(httprequest)
- else:
- _logger.debug("Odoo HTTP: Using original get_request for mimetype: %s", httprequest.mimetype)
- return _original_get_request(self, httprequest)
-
-odoo.http.Root.get_request = _get_request_override \ No newline at end of file