diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-06-04 13:11:31 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-06-04 13:11:31 +0700 |
| commit | 9228e331a2b4c3f80eb22ec824a14633b6235972 (patch) | |
| tree | 21869d3f4f6e742108e2822293f8d8b29ec1a9f8 /indoteknik_custom/patch.py | |
| parent | e43e3d0da19e5cbbcbadec40c252c24d2921149c (diff) | |
(andri) add patch untuk bypass response kosong add biteship
Diffstat (limited to 'indoteknik_custom/patch.py')
| -rw-r--r-- | indoteknik_custom/patch.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/indoteknik_custom/patch.py b/indoteknik_custom/patch.py new file mode 100644 index 00000000..704ab056 --- /dev/null +++ b/indoteknik_custom/patch.py @@ -0,0 +1,16 @@ +import json, logging +from odoo.http import JsonRequest + +_logger = logging.getLogger(__name__) + +def _safe_jsonloads(self, raw): + """Kembalikan dict kosong bila body kosong / JSON rusak""" + try: + return json.loads(raw) if raw else {} + except Exception as e: + _logger.warning("Bypassed invalid JSON body: %s", e) + return {} + +# Odoo 14 memakai _jsonloads +JsonRequest._jsonloads = _safe_jsonloads +_logger.info("Patch OK → JsonRequest._jsonloads dilindungi (empty JSON diterima)") |
