summaryrefslogtreecommitdiff
path: root/indoteknik_custom/patch.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2025-06-16 01:39:22 +0000
committerIT Fixcomart <it@fixcomart.co.id>2025-06-16 01:39:22 +0000
commit27bfdedcb547fdf9f4cca084c77f966375f748f0 (patch)
tree627a7bf82b6f664037a62d4ffbf451262d0ad526 /indoteknik_custom/patch.py
parentb87f89b8af2731e02d6ab095c3e92e48b39b4f6c (diff)
parentdf02e9c6f0db21b43ae25d77c7072a5dd15f9848 (diff)
Merged in biteship-v1 (pull request #329)
Biteship v1
Diffstat (limited to 'indoteknik_custom/patch.py')
-rw-r--r--indoteknik_custom/patch.py16
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)")