summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-02 11:38:18 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-02 11:38:18 +0700
commitb74109805a2ec65cb4a4b7811fdc34403d2505b2 (patch)
treeb021b0a0a1f9b8d6d432cfc7f2ff09b9d71183f9
parent84a038cff26c28bd714fd6744f48c2b0e91cf347 (diff)
(andri) tambah validasi jika kurir tidak mendukung
-rwxr-xr-xindoteknik_custom/models/sale_order.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 4b4e06cd..74d96314 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -856,6 +856,9 @@ class SaleOrder(models.Model):
raise UserError("Gagal mendapatkan ID kota tujuan.")
result = self._call_rajaongkir_api(total_weight, destination_subsdistrict_id)
+ if not result or not result.get('data'):
+ raise UserError(_("Kurir %s tidak tersedia untuk tujuan ini. Silakan pilih kurir lain.") % self.carrier_id.name)
+
if result:
shipping_options = []
@@ -1278,7 +1281,7 @@ class SaleOrder(models.Model):
params = {
'search': search,
- 'limit': 10
+ 'limit': 5
}
try: