diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-06-09 15:11:05 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-06-09 15:11:05 +0700 |
| commit | 1bc03c1482a664ffcd58f19022a40e65e21774c6 (patch) | |
| tree | f491d00cd1d371c8fd76ad25e014ac8d662c3d02 /indoteknik_custom/patch.py | |
| parent | 1bd3a91889f8616d7042c0d15315c2f25c974ed3 (diff) | |
| parent | f43855aa55265794c7774af79089258e830b0df4 (diff) | |
(andri) fix merge biteship with odoo-backup
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)") |
