diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-24 11:36:25 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-24 11:36:25 +0700 |
| commit | 4d99d85f04f43b05eded0e25f49f1c3c75ba3314 (patch) | |
| tree | 737589d3e0117ad5119dba0606ad8570de076b40 | |
| parent | c420bd4e418b2f646e1b3116bdb31e4ff07bf448 (diff) | |
Refactor format eta on generate_eta_delivery
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index c094b74d..3c064f8f 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -430,11 +430,10 @@ class StockPicking(models.Model): longest_days = 3 longest_eta = fastest_eta + datetime.timedelta(days=longest_days) - if fastest_eta.year == longest_eta.year: - formatted_fastest_eta = fastest_eta.strftime('%d %b') - formatted_longest_eta = longest_eta.strftime('%d %b %Y') - else: - formatted_fastest_eta = fastest_eta.strftime('%d %b %Y') - formatted_longest_eta = longest_eta.strftime('%d %b %Y') + format_time = '%d %b %Y' + format_time_fastest = '%d %b' if fastest_eta.year == longest_eta.year else format_time + + formatted_fastest_eta = fastest_eta.strftime(format_time_fastest) + formatted_longest_eta = longest_eta.strftime(format_time) return f'{formatted_fastest_eta} - {formatted_longest_eta}' |
