diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2023-08-09 03:56:19 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2023-08-09 03:56:19 +0000 |
| commit | cdbb16de1b4da9fdc5f170d411d2bf3b489bfafb (patch) | |
| tree | 9ab7a89d6c147b9a952736a440f52af7fd41c854 /indoteknik_custom | |
| parent | 218da29eef3757461b65308b1966594bd12da206 (diff) | |
| parent | 207c8f4f288e841d4f69525c9d688f230d116ff6 (diff) | |
Merged in development (pull request #90)
airway bill
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 |
