From 7f4510f2459e16b7b3f1828f736ec84bc7ea97dc Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 15 Jul 2025 08:53:29 +0700 Subject: fix bug api kgx --- indoteknik_custom/models/stock_picking.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index b9c90551..0efffd2f 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -320,13 +320,18 @@ class StockPicking(models.Model): """Parse datetime string dari format KGX""" try: from datetime import datetime - # Hilangkan timezone jika ada masalah parsing + + if not dt_str: + return False + if '+' in dt_str: dt_str = dt_str.split('+')[0] + return datetime.strptime(dt_str, '%Y-%m-%dT%H:%M:%S') except ValueError: return False + def action_get_kgx_pod(self, shipment=False): self.ensure_one() -- cgit v1.2.3