summaryrefslogtreecommitdiff
path: root/indoteknik_custom/patch.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-06-18 11:16:12 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-06-18 11:16:12 +0700
commit1a6ad278493ef88e01485d72ebc697b61aec077a (patch)
treef0db9f96cea9cd2a3e490d01b2dd1e0020fb0bf3 /indoteknik_custom/patch.py
parent9d7d71f23de6335464d96d2a04ba8b36db620105 (diff)
parentcca31a5f582e097518701a192d4cda88525fc979 (diff)
<hafid> merging & fix tempo
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)")