summaryrefslogtreecommitdiff
path: root/indoteknik_custom
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-08-08 09:01:32 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-08-08 09:01:32 +0700
commit4d665c47060f4d3506d7dffe7f18a2d481fe5497 (patch)
tree5637c77c3d22828e29175868dbb5b0f20b5a605e /indoteknik_custom
parente183c3662edc0ac493228c780b42c07eea00cc74 (diff)
airway bill
Diffstat (limited to 'indoteknik_custom')
-rw-r--r--indoteknik_custom/models/airway_bill_manifest.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/indoteknik_custom/models/airway_bill_manifest.py b/indoteknik_custom/models/airway_bill_manifest.py
index a606c2be..2da60f27 100644
--- a/indoteknik_custom/models/airway_bill_manifest.py
+++ b/indoteknik_custom/models/airway_bill_manifest.py
@@ -5,7 +5,7 @@ _logger = logging.getLogger(__name__)
class AirwayBillManifest(models.Model):
_name = 'airway.bill.manifest'
- _description = 'Airway B ill Line'
+ _description = 'Airway Bill Line'
_order = 'waybill_id, id'
waybill_id = fields.Many2one('airway.bill', string='Airway Ref', required=True, ondelete='cascade', index=True, copy=False)
@@ -19,7 +19,10 @@ class AirwayBillManifest(models.Model):
try:
history = waybill.decode_response()
manifests = history['rajaongkir']['result']['manifest'] or []
- for manifest in manifests:
+
+ sorted_manifests = sorted(manifests, key=lambda x: x['manifest_date'] + ' ' + x['manifest_time'], reverse=True)
+
+ for manifest in sorted_manifests:
code = manifest['manifest_code']
description = manifest['manifest_description']
date = manifest['manifest_date']
@@ -29,8 +32,8 @@ class AirwayBillManifest(models.Model):
'waybill_id': waybill.id,
'code': code,
'description': description,
- 'datetime': date+' '+time,
+ 'datetime': date + ' ' + time,
'city': city,
})
except:
- return \ No newline at end of file
+ return