Adrien Widart
716bc63dd2
[FIX] stock: filter quants when updating qty
...
In some cases, when making an inventory adjustment, the `in_date` of the
new quant will be incorrect
To reproduce the issue:
(Let D01 be the current date)
1. Create a storable product P
2. Set its quantity to 1
3. Process a delivery order with 1 x P
4. Set the date in the future
- Let D02 be this date
5. Make an inventory adjustment with 1 x P
Error: The `in_date` of the quant (for P in the stock location) is D01
instead of D02 (can be observed either directly in PSQL, on the form
view of the quant (via Locations > Current Stock), or by adding the
field on the tree view)
When validating the stock adjustment, at some point, the module calls
`_action_done` on a SML (1 x P from Inventory Adjustment to the Stock
Location). To do so, it decreases the quantity of the origin location
and increases the quantity of the destination location thanks to
`_update_available_quantity`:
https://github.com/odoo/odoo/blob/b4a9e5b8307ab1b730effe2de23f15260326ef6c/addons/stock/models/stock_move_line.py#L485-L493
But here is the issue: when decreasing the quantity in the virtual
location (Inventory Adjustment), it finds an old quant (the one from
step 2 in above use case). It then stores its `in_date` (D01) and since
this date is before the current one (D02), D01 is kept, used to update
the quant quantity and returned in `action_done`. As a result, when
increasing the quantity in the stock location,
`_update_available_quantity` is called with the parameter `in_date`
defined and equal to D01. Again, D01 will be the earliest date, so the
date will be used to create/update the quant in stock location.
OPW-2702198
closes odoo/odoo#83009
X-original-commit: e27ee5cd6b19351a00030310d1db3a0defe5b31a
Signed-off-by: Arnold Moyaux <arm@odoo.com >
Signed-off-by: Adrien Widart <awt@odoo.com >
2022-01-19 14:06:45 +00:00
..
2022-01-19 13:15:00 +00:00
2021-12-14 19:13:18 +00:00
2021-11-10 06:49:58 +00:00
2022-01-05 11:36:06 +00:00
2021-12-24 13:11:50 +00:00
2021-11-22 14:48:04 +00:00
2022-01-10 19:28:36 +00:00
2021-12-08 16:28:53 +00:00
2021-12-02 13:43:19 +00:00
2021-11-08 09:25:47 +00:00
2021-11-23 11:12:14 +00:00
2021-12-24 17:10:42 +00:00
2021-12-08 11:17:22 +00:00
2021-11-26 09:44:58 +00:00
2021-11-10 09:58:09 +00:00
2021-11-12 18:07:15 +00:00
2021-11-22 14:48:04 +00:00
2021-11-22 14:48:04 +00:00
2021-12-08 11:17:22 +00:00
2021-12-14 19:13:18 +00:00
2022-01-12 13:10:57 +00:00
2021-12-07 13:48:53 +00:00
2021-11-22 14:48:04 +00:00
2021-12-14 12:39:54 +00:00
2021-10-28 09:17:34 +00:00
2021-12-07 13:48:53 +00:00
2021-12-13 12:24:50 +00:00
2022-01-04 10:26:10 +00:00
2022-01-18 09:14:47 +00:00
2021-12-16 09:00:19 +00:00
2021-12-14 19:13:18 +00:00
2021-12-24 14:57:03 +00:00
2021-12-07 13:48:53 +00:00
2021-12-15 00:10:51 +00:00
2021-12-14 12:39:54 +00:00
2022-01-18 13:40:37 +00:00
2021-12-02 12:12:01 +01:00
2021-12-08 09:35:03 +00:00
2021-12-17 11:04:53 +00:00
2021-12-16 17:33:47 +00:00
2022-01-12 16:43:37 +00:00
2021-12-24 14:57:02 +00:00
2022-01-12 16:43:37 +00:00
2021-12-16 17:33:47 +00:00
2022-01-12 07:44:06 +00:00
2022-01-13 09:30:56 +00:00
2021-12-07 13:48:53 +00:00
2022-01-17 08:38:45 +00:00
2021-11-22 14:48:04 +00:00
2022-01-12 08:33:00 +00:00
2022-01-07 07:26:53 +00:00
2021-12-21 07:17:57 +00:00
2022-01-03 18:11:18 +00:00
2022-01-11 16:18:49 +00:00
2021-12-14 19:13:18 +00:00
2022-01-12 15:49:12 +00:00
2021-12-07 13:48:53 +00:00
2021-12-14 19:13:18 +00:00
2021-12-09 16:14:43 +00:00
2021-12-07 13:48:53 +00:00
2022-01-12 16:43:08 +00:00
2021-12-25 02:26:44 +00:00
2021-12-20 07:55:41 +00:00
2021-12-15 12:07:26 +00:00
2022-01-11 09:29:48 +00:00
2022-01-03 18:11:19 +00:00
2021-12-07 13:48:53 +00:00
2022-01-12 15:49:12 +00:00
2022-01-04 10:26:16 +00:00
2021-12-14 12:39:54 +00:00
2022-01-13 13:40:42 +00:00
2021-11-25 00:31:17 +00:00
2021-12-08 11:17:22 +00:00
2022-01-18 16:17:43 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2022-01-13 14:35:57 +00:00
2022-01-18 08:18:06 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2022-01-17 15:57:46 +00:00
2022-01-18 16:17:43 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2021-12-18 21:00:49 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-11-09 14:46:05 +00:00
2021-11-25 00:31:17 +00:00
2022-01-18 16:17:43 +00:00
2021-11-05 13:00:41 +00:00
2021-12-28 09:47:33 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-03 08:11:50 +00:00
2022-01-11 08:36:38 +00:00
2021-12-13 11:32:57 +00:00
2021-12-17 21:59:10 +00:00
2022-01-11 13:34:56 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2022-01-18 11:02:02 +00:00
2021-12-14 14:47:25 +00:00
2021-11-25 00:31:17 +00:00
2022-01-07 19:54:44 +00:00
2022-01-06 19:31:05 +00:00
2022-01-14 14:49:57 +00:00
2021-11-25 00:31:17 +00:00
2021-12-14 19:13:18 +00:00
2021-11-08 11:08:06 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2022-01-12 10:17:47 +00:00
2021-11-09 14:46:05 +00:00
2021-12-28 09:47:39 +00:00
2021-12-14 10:00:41 +00:00
2021-11-25 00:31:17 +00:00
2021-11-22 14:48:04 +00:00
2021-11-25 00:31:17 +00:00
2022-01-18 16:17:43 +00:00
2021-12-22 00:12:52 +00:00
2021-11-25 00:31:17 +00:00
2021-11-29 08:06:24 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2022-01-05 23:05:43 +00:00
2021-12-20 10:49:49 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-14 09:11:15 +00:00
2022-01-11 16:18:54 +00:00
2022-01-18 16:17:39 +00:00
2021-12-15 00:10:51 +00:00
2021-12-21 09:49:38 +00:00
2021-12-24 09:52:42 +00:00
2021-12-14 19:13:18 +00:00
2022-01-12 18:24:48 +00:00
2022-01-17 13:12:26 +00:00
2021-12-07 13:48:53 +00:00
2022-01-06 11:45:23 +00:00
2021-12-14 19:13:18 +00:00
2022-01-17 08:38:45 +00:00
2022-01-17 14:07:46 +00:00
2022-01-18 15:25:51 +00:00
2021-12-07 16:20:05 +00:00
2022-01-11 15:24:11 +00:00
2021-12-22 17:55:49 +00:00
2021-12-07 16:20:05 +00:00
2021-12-07 16:20:06 +00:00
2021-12-07 16:20:06 +00:00
2022-01-14 15:44:48 +00:00
2022-01-06 08:35:07 +00:00
2021-11-29 15:40:54 +00:00
2022-01-18 07:32:58 +00:00
2022-01-18 11:02:14 +00:00
2021-12-23 09:37:12 +00:00
2021-12-02 12:55:38 +00:00
2021-11-29 15:40:54 +00:00
2021-11-29 15:40:54 +00:00
2021-11-29 15:40:54 +00:00
2021-11-29 15:40:54 +00:00
2021-11-29 15:40:54 +00:00
2021-11-29 15:40:54 +00:00
2022-01-18 14:33:59 +00:00
2022-01-14 16:37:45 +00:00
2021-11-22 14:48:04 +00:00
2021-11-22 14:48:04 +00:00
2021-12-03 14:19:06 +00:00
2022-01-11 11:21:04 +00:00
2021-12-07 19:27:40 +00:00
2022-01-18 14:33:59 +00:00
2021-11-15 11:22:40 +00:00
2021-12-21 08:55:44 +00:00
2021-11-22 14:48:04 +00:00
2022-01-08 01:11:39 +00:00
2021-12-08 11:17:22 +00:00
2021-12-17 11:58:44 +00:00
2022-01-18 11:56:55 +00:00
2021-12-07 16:20:05 +00:00
2022-01-18 14:33:55 +00:00
2022-01-04 17:03:10 +00:00
2021-12-14 12:39:54 +00:00
2022-01-04 17:03:10 +00:00
2022-01-04 17:03:10 +00:00
2021-12-14 19:13:18 +00:00
2022-01-17 14:07:46 +00:00
2022-01-10 14:49:52 +00:00
2021-11-24 16:33:01 +00:00
2021-12-14 19:13:18 +00:00
2021-10-27 15:48:51 +00:00
2022-01-14 18:24:04 +00:00
2022-01-05 13:58:01 +01:00
2022-01-11 15:24:11 +00:00
2022-01-12 16:43:24 +00:00
2022-01-18 08:18:02 +00:00
2021-12-23 15:30:23 +01:00
2021-12-14 14:47:25 +00:00
2021-12-02 12:12:01 +01:00
2021-12-02 12:12:03 +01:00
2022-01-17 12:17:24 +00:00
2021-12-02 12:12:03 +01:00
2022-01-18 15:25:51 +00:00
2021-12-23 15:30:23 +01:00
2021-12-02 12:12:03 +01:00
2022-01-18 11:56:59 +00:00
2021-11-23 11:12:14 +00:00
2022-01-18 11:02:06 +00:00
2022-01-14 17:29:35 +00:00
2022-01-18 15:25:51 +00:00
2021-11-08 07:59:42 +00:00
2022-01-12 13:11:00 +00:00
2021-11-29 14:55:35 +00:00
2021-12-21 20:20:50 +00:00
2022-01-05 12:50:16 +00:00
2022-01-05 12:50:16 +00:00
2021-10-29 16:05:23 +00:00
2022-01-19 14:06:45 +00:00
2022-01-18 15:25:51 +00:00
2021-12-07 16:20:06 +00:00
2021-12-14 19:13:18 +00:00
2022-01-13 09:30:52 +00:00
2022-01-14 13:53:56 +00:00
2021-11-19 19:36:49 +00:00
2021-12-24 14:57:02 +00:00
2021-12-29 16:55:47 +00:00
2021-12-21 20:20:50 +00:00
2022-01-06 19:30:53 +00:00
2021-11-16 16:58:36 +00:00
2021-12-22 15:45:53 +00:00
2022-01-17 16:56:01 +00:00
2021-11-30 15:21:47 +00:00
2022-01-17 06:42:47 +00:00
2021-12-07 13:48:53 +00:00
2021-12-07 13:48:53 +00:00
2022-01-18 13:40:47 +00:00
2022-01-19 10:30:52 +00:00
2021-11-24 18:38:02 +00:00
2022-01-16 23:36:46 +00:00
2022-01-19 12:23:07 +00:00
2021-12-07 13:48:53 +00:00
2021-10-29 16:05:23 +00:00
2022-01-14 16:37:46 +00:00
2022-01-12 14:55:03 +00:00
2021-12-07 13:48:53 +00:00
2021-12-07 13:48:53 +00:00
2022-01-10 13:52:27 +00:00
2022-01-10 13:52:27 +00:00
2021-12-16 17:33:48 +00:00
2022-01-04 08:47:00 +00:00
2022-01-10 13:52:27 +00:00
2021-12-07 13:48:53 +00:00
2022-01-12 14:55:03 +00:00
2021-12-29 16:55:47 +00:00
2021-12-20 19:16:55 +00:00
2021-12-17 12:51:49 +00:00
2021-12-20 11:39:03 +01:00
2022-01-17 14:07:46 +00:00
2021-12-07 13:48:53 +00:00
2021-11-25 13:28:51 +00:00
2021-12-17 12:51:49 +00:00
2021-12-02 12:12:01 +01:00
2021-11-16 13:03:03 +00:00
2021-12-07 13:48:53 +00:00
2021-12-23 15:30:23 +01:00
2021-12-23 15:30:23 +01:00
2021-12-07 13:48:53 +00:00
2022-01-18 13:40:52 +00:00
2021-12-07 13:48:53 +00:00
2021-12-14 19:13:18 +00:00
2021-12-14 19:13:18 +00:00