From f06397b2e68b8cfb1de274e4a96b69a78a85339c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 28 Jan 2020 09:20:32 +0000 Subject: [PATCH] [FIX] stock_landed_costs: skip cancel move - Create a product A, FIFO and Automated - Create a PO for 50 units - Receive 45 units, no backorder - Create a landed cost for the picking The landed cost is split between the two move lines (45 units and 5 units). This occurs since in v13, there is no canceled picking created for the backorder, but a canceled stock move. We filter out canceled moves. opw-2179145 closes odoo/odoo#44095 X-original-commit: 120a2d116e4820fa9a4529e8ef01569823d02d13 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock_landed_costs/models/stock_landed_cost.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py index 91f8d42cdae..0e7f69c901d 100644 --- a/addons/stock_landed_costs/models/stock_landed_cost.py +++ b/addons/stock_landed_costs/models/stock_landed_cost.py @@ -201,7 +201,7 @@ class LandedCost(models.Model): for move in self.mapped('picking_ids').mapped('move_lines'): # it doesn't make sense to make a landed cost for a product that isn't set as being valuated in real time at real cost - if move.product_id.valuation != 'real_time' or move.product_id.cost_method not in ('fifo', 'average'): + if move.product_id.valuation != 'real_time' or move.product_id.cost_method not in ('fifo', 'average') or move.state == 'cancel': continue vals = { 'product_id': move.product_id.id,