summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2024-06-05 02:29:48 +0000
committerIT Fixcomart <it@fixcomart.co.id>2024-06-05 02:29:48 +0000
commitec4aefc64a9f42d1b40d03048fc384e158191218 (patch)
tree14d1fd1358ae41d65b9412fdfc0195c8dd9f20bd /indoteknik_custom/models/sale_order.py
parentabd7dd1ecc9246b1924dcf70b3ed41c964f3746f (diff)
parent9306992db370c793e8cab494038b0de5b61b600f (diff)
Merged in production (pull request #144)
Production
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
-rwxr-xr-xindoteknik_custom/models/sale_order.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index d246f37f..9a4f9035 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -242,6 +242,14 @@ class SaleOrder(models.Model):
'Authorization': midtrans_auth,
}
+ check_url = f'https://api.midtrans.com/v2/{so_number}/status'
+ check_response = requests.get(check_url, headers=headers)
+
+ if check_response.status_code == 200:
+ status_response = check_response.json()
+ if status_response.get('transaction_status') == 'expire':
+ so_number = so_number + '-cpl'
+
json_data = {
'transaction_details': {
'order_id': so_number,
@@ -415,7 +423,7 @@ class SaleOrder(models.Model):
if self.payment_term_id.id == 31 and self.total_percent_margin < 25:
raise UserError("Jika ingin menggunakan Tempo 90 Hari maka margin harus di atas 25%")
- if self.warehouse_id.id != 8: #GD Bandengan
+ if self.warehouse_id.id != 8 and self.warehouse_id.id != 10: #GD Bandengan
raise UserError('Gudang harus Bandengan')
if self.state not in ['draft', 'sent']: