diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2017-12-05 15:00:07 +0100 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2017-12-06 14:30:44 +0100 |
| commit | af8908b03c73f8bb5b6ff3a60171caedaf017e82 (patch) | |
| tree | a9ecf8efb33a04c98a3e9ea0d47847f43500efc6 | |
| parent | 9d0b4d0c2d9e970f614ebe8ce7cabe35275ebfc9 (diff) | |
[FIX] stock: do not propagate date when negative delta
In Pick - Ship:
- validate a sale order which scheduled date is an hour in the future.
- validate the WH/PICK picking
Before this commit the WH/OUT picking 's scheduled date was set a day in the **past**
This was due to the implementation of datetime substraction and timedelta, which,
in case of a negative value, would take -1 day and some complementary values (hours, minutes etc...)
(the difference is complementary)
After this commit, the WH/OUT picking 's scheduled date stays what it was in that particular use case.
OPW 784452
| -rw-r--r-- | addons/stock/models/stock_move.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 26db3fa010f..a5b97bc7938 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -283,7 +283,7 @@ class StockMove(models.Model): if propagated_date_field: current_date = datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) new_date = datetime.strptime(vals.get(propagated_date_field), DEFAULT_SERVER_DATETIME_FORMAT) - delta = new_date - current_date + delta = relativedelta.relativedelta(new_date, current_date) if abs(delta.days) >= move.company_id.propagation_minimum_delta: old_move_date = datetime.strptime(move.move_dest_id.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) new_move_date = (old_move_date + relativedelta.relativedelta(days=delta.days or 0)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) |
