Name: [FIX] viin_rental_stock: avoid conflict with original Sale Order

State: Killed finished in 306m

PR State: merged

PR Author: Roy Le

PR Author Email:

PR: #2405

Committer: Roy Le

Committer Email: roy.le@viindoo.com

Commit: e5b4157552af05362c5f6b0df7556095723ce524

Description:

                                            [FIX] viin_rental_stock: avoid conflict with original Sale Order

-Odoo has new test call
test_2_steps_fixed_procurement_propagation_with_backorder at
odoo/commit/0c8f0d14d29117e689d8e4c3331bc90b29ab1b98
-Problem is: When run that test with all modules installed, we will
failed about 2-3 time
-Why: take a look at this code
https://github.com/Viindoo/odoo/blob/819966bfb2b76eb823e937dc8edc902910514da0/addons/stock/models/stock_rule.py#L497
-> the result will always give us 1 stock.rule record but sometime
stock.rule is not the exact that we want it to be. Try removing the
'limit=1' and we will always get 2 stock.rule record , one is the right
for the above test case (with 'group_probagate_option' is 'fixed') and
the other is not. Also try to see the 'order' option include
'route_sequence' and 'sequence' always the same for 2 record (20 vs 20
for 'route_sequence' and 10 vs 10 for 'sequence'), so sometime we will
get the smaller id which is the correct one and sometime the larger id
which is incorrect one
=======
Debugging further more at those 2 stock.rule records , and notice one is
created via 'viin_rental_stock' (try printing 'res.route_id.name' and
you 'll see)
-Solution: Modifying the domain before performing stock.rule searching
to exclude the 'route_id' of the 'warehouse.rental_route_id' if the
'Sale Order' does not have rental product
                                            

Branch: 15.0

Instance ID: 0

Age:

Up-time: