Commit Graph

13 Commits

Author SHA1 Message Date
Jacques-Etienne Baudoux
70b5139d93 [FIX] stock_reserve_rule: rule matching
A move from "Stock/Zone1/A" must match removal rules defined for
"Stock/Zone1"
2021-12-16 13:24:03 +01:00
Sébastien Alix
02ea087509 [MIG] stock_reserve_rule: Migration to 14.0 2021-08-11 16:13:01 +02:00
Guewen Baconnier
08d4273737 Modify packaging rule to always respect fifo, lifo, ...
The former implementation was to take as much as possible of the largest
packaging, to the smallest packacking, to have less to move.
Then, only, removal order (fifo, ...) was applied for equal quantities.
It is more important to respect removal order than limiting the
operations, so remove this "optimization".
2021-08-11 11:55:48 +02:00
Guewen Baconnier
d8274ce196 Modify empty bin rule to always respect fifo, lifo, ...
The former implementation was sorting the quants per location and trying
to take as much quantities as possible from the same locations, to limit
the number of operations to do. Then, only, removal order (fifo, ...)
was applied. It is more important to respect removal order than limiting
the operations, so remove this "optimization".
2021-08-11 11:55:48 +02:00
Guewen Baconnier
df56837fdd Change picking type to many2many in reserve rules 2021-08-11 11:55:48 +02:00
Guewen Baconnier
d962ccbf23 Fix test incompatibility with stock_reserve_rule
The rules created in demo data of stock_reserve_rule make the tests of
stock_vertical_lift (and possibly other modules) fail because the
transfers can't be made available.

Deactivate the rule in stock_reserve_rule and activate it only in its
tests. Users can still activate the rule manually to test.
2021-08-11 11:55:48 +02:00
Guewen Baconnier
acd988189e Add explicit filter on picking type 2021-08-11 11:55:48 +02:00
Guewen Baconnier
77d2c7fa0c Remove fallback location
It could not work properly here as we need the "fallback" to apply
even if there is no quantity at all in the stock. As we hook the
reservation rules in StockMove._update_reserved_quantity(), and
this method is called only if we have at least 1 product in qty,
the fallback was not applied with zero qty.

A new module will handle this concept: https://github.com/OCA/wms/pull/28
2021-08-11 11:55:48 +02:00
Guewen Baconnier
4ae12c21ce Fix application of removal rules too broad
Example of configuration:

Rule location: Stock
Removal rule 1: Stock/Zone1
Removal rule 2: Stock/Zone2

Reservation of a stock move with Stock/Zone2 as source location.

Previously, it would reserve in Stock/Zone1.
Now, it will never be allowed to reserve in Stock/Zone1.

A warning message was added previously to warn the user about potential
issues, which is now obsolete so I removed it.
2021-08-11 11:55:48 +02:00
Guewen Baconnier
3d14192088 Fix bug in fallback when no quantity could be reserved
Before the change, the implementation of the fallback goes like this:

If I reserve a move of 3000 and it finds 600 units, it splits the move
to create a new move of 2400 and pretend to the caller that 3000 was
reserved so the initial move is changed to 'assigned'.

Now, if we have a move of 2400 and finds zero, it still splits the move,
and pretend to the caller that 2400 was reserved → the initial move has
no move line but is assigned. In this case, we should not split the move
but only update the source location of the move.
2021-08-11 11:55:48 +02:00
sebalix
42d9c733f0 [IMP] stock_reserve_rule: add constraints on fallback locations 2021-08-11 11:55:48 +02:00
Guewen Baconnier
dfc97bb24d Migrate stock_reserve_rule to 13.0 2021-08-11 11:55:48 +02:00
Guewen Baconnier
fdab54b432 Add stock_reserve_rule 2021-08-11 11:55:48 +02:00