-
- Downloads
[IMP] mrp,{purchase_,sale_}stock,stock: decrease qty cascade on MTO
Allow the quantity decrease of Sale Order line of a MTO product. When increasing de quantities, the related pickings, RFQ / PO are increased as well, but it wasn't the case if decreasing the quantity. It should allow the cascade of the decrease in the related pickings as it would work for the increase. Also modifies a related Purchase Order if it wasn't yet validated (and thus still a RFQ). merge_moves was modified so it would allow the merge of negative moves with positive ones, while trying to "deplete" as much quantity as possible for each mergeable move. But negative moves don't always have all required properties to be compared to the positive ones (some keys might be missing, such as 'created_production_id'). That means we will merge strictly the positive moves at first as it was done before. But then we try to merge them "less strictly", using less keys to compare. Let's say we have those moves (and all other relevant keys matches) : - move_1 : {qty : 5, created_production_id: 1} - move_2 : {qty : 3, created_production_id: 2} - move_3 : {qty : -6, created_production_id: False} move_1 and move_2 cannot be merged as they don't share the same created_production_id. But to merge move_3, we'll need to merge it into move_1 and move_2. It will then deplete move_1 and decrease move_2. Which will leave us with : - move_1 : {qty : 0, created_production_id: 1} - move_2 : {qty : 2, created_production_id: 2} move_3 will be unliked as its purpose is done. Task-2513592 Part-of: odoo/odoo#78070
Showing
- addons/mrp/models/stock_move.py 4 additions, 0 deletionsaddons/mrp/models/stock_move.py
- addons/mrp/models/stock_rule.py 4 additions, 1 deletionaddons/mrp/models/stock_rule.py
- addons/mrp/tests/test_procurement.py 76 additions, 0 deletionsaddons/mrp/tests/test_procurement.py
- addons/purchase_stock/models/purchase.py 2 additions, 2 deletionsaddons/purchase_stock/models/purchase.py
- addons/purchase_stock/models/stock.py 5 additions, 1 deletionaddons/purchase_stock/models/stock.py
- addons/purchase_stock/models/stock_rule.py 15 additions, 9 deletionsaddons/purchase_stock/models/stock_rule.py
- addons/purchase_stock/tests/test_create_picking.py 84 additions, 0 deletionsaddons/purchase_stock/tests/test_create_picking.py
- addons/sale_stock/models/sale_order.py 3 additions, 25 deletionsaddons/sale_stock/models/sale_order.py
- addons/sale_stock/tests/test_sale_stock.py 39 additions, 0 deletionsaddons/sale_stock/tests/test_sale_stock.py
- addons/stock/models/stock_move.py 57 additions, 16 deletionsaddons/stock/models/stock_move.py
- addons/stock/models/stock_rule.py 8 additions, 4 deletionsaddons/stock/models/stock_rule.py
Loading
Please register or sign in to comment