diff options
Diffstat (limited to 'indoteknik_custom')
| -rw-r--r-- | indoteknik_custom/models/airway_bill_manifest.py | 11 |
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 |
