diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-06-09 08:13:07 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-06-09 08:13:07 +0000 |
| commit | cc34adff6f39845b0a81650285aa1e75d8948dc4 (patch) | |
| tree | 46e94e13b5879b35aeb1eecc554c009734b230a9 | |
| parent | 1bd3a91889f8616d7042c0d15315c2f25c974ed3 (diff) | |
| parent | 03bceb0f2641c1f7303dffcf0dcbc855c70cffb3 (diff) | |
Merged in fix_commitment_date (pull request #325)
<hafid> fix commitment date kosong
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 705d16ef..565e8a19 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2109,11 +2109,15 @@ class SaleOrder(models.Model): ], limit=1) picking_in = stock_move.picking_id result_date = picking_in.date_done if picking_in else None - if result_date: + + if result_date and eta and isinstance(eta, (datetime.date, datetime.datetime)): status = "Early" if result_date < eta else "Delay" result_date_str = result_date.strftime('%m/%d/%Y') eta_str = eta.strftime('%m/%d/%Y') order.ready_to_ship_status_detail = f"Expected: {eta_str} | Realtime: {result_date_str} | {status}" + elif not eta: + # If eta is missing or False, treat as 'On Track' or you may choose different logic + order.ready_to_ship_status_detail = "On Track" else: order.ready_to_ship_status_detail = "On Track" else: |
