summaryrefslogtreecommitdiff
path: root/indoteknik_custom/patch.py
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-06-17 08:11:32 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-06-17 08:11:32 +0700
commita2a003a86379fab81b2df36cff5022e1d22a589d (patch)
tree72cb451d0793837d785b74beb79cfe5df000bfc4 /indoteknik_custom/patch.py
parentabd7da741c6eec02dbefa195b91dbedd70b3323e (diff)
parenta8460239603b7a73a185fec394b0f95ab0247207 (diff)
<miqdad> merge odoo-backup
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)")