summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-05-21 11:47:03 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-05-21 11:47:03 +0700
commitb4448913dc446840c21d2403a58cd7edcc13be4a (patch)
treec56654855867367e865b88a5237ec02db4f4df3a /indoteknik_custom/models
parent3c43dad74ebb3feef42ddb871a794ea1763e7008 (diff)
add view of ged tracking
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/ged.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py
index 5de47a6e..2de88a8d 100644
--- a/indoteknik_custom/models/ged.py
+++ b/indoteknik_custom/models/ged.py
@@ -21,8 +21,11 @@ password = 'faCE2HFFKdzhvPW'
x_ged_key = 'Indoteknikdotcom'
x_ged_password = 'Ind0t3kn1kdotc0m4p1'
+
class GedTracking(models.Model):
_name = 'ged.tracking'
+ _order = 'awb_no desc'
+ _rec_name = 'awb_no'
status = fields.Char(string='Status')
messages = fields.Char(string='Messages')
@@ -55,6 +58,7 @@ class GedTracking(models.Model):
last_description = fields.Char(string='Last Description')
last_status_detail = fields.Char(string='Last Status Detail')
last_status = fields.Char(string='Last Status')
+ tracking_line = fields.One2many('ged.tracking.line', 'ged_tracking_id', string='Tracking Lines', auto_join=True)
class GedTrackingLine(models.Model):
@@ -77,6 +81,13 @@ class GedTrackingLine(models.Model):
gps = fields.Char(string='GPS')
+class GedTrackingLog(models.Model):
+ _name = 'ged.tracking.log'
+
+ responses = fields.Char(string='Responses')
+ body = fields.Char(string='Body')
+
+
class GedApi(models.Model):
_name = 'ged.api'
@@ -136,9 +147,14 @@ class GedApi(models.Model):
}
}
response = requests.post(url_tracking, headers=headers, json=json_data)
+ log = {
+ 'body': str(json_data),
+ 'responses': str(response.json())
+ }
+ self.env['ged.tracking.log'].create(log)
+
info_awb = response.json()['infoawb']
last_status = response.json()['laststatus']
-
status = response.json()['status']
messages = response.json()['messages']
awb_no = info_awb['awb_no']