From c05ea98509aa4f47e28045433e29694e35aebfc6 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 22 Apr 2021 17:32:30 +0200 Subject: [PATCH] [FIX] stock_picking_report_valued_sale_mrp: ignored cancelled order We want to consider backordered moves even if they're cancelled but not cancelled moves from cancelled orders, that must be filtered. Otherwise, they pullute the amounts computation. --- stock_picking_report_valued_sale_mrp/__manifest__.py | 2 +- .../models/stock_move.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stock_picking_report_valued_sale_mrp/__manifest__.py b/stock_picking_report_valued_sale_mrp/__manifest__.py index d5fbc69..b647ce1 100644 --- a/stock_picking_report_valued_sale_mrp/__manifest__.py +++ b/stock_picking_report_valued_sale_mrp/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Valued picking linked with MRP Kits", "summary": "Allow to summarize the picking related with the selled kits", - "version": "12.0.1.0.1", + "version": "12.0.1.0.2", "development_status": "Beta", "category": "Warehouse Management", "website": "https://github.com/OCA/stock-logistics-reporting", diff --git a/stock_picking_report_valued_sale_mrp/models/stock_move.py b/stock_picking_report_valued_sale_mrp/models/stock_move.py index 58c4e87..c81369d 100644 --- a/stock_picking_report_valued_sale_mrp/models/stock_move.py +++ b/stock_picking_report_valued_sale_mrp/models/stock_move.py @@ -17,5 +17,12 @@ class StockMove(models.Model): component_demand = sum( sale_line.move_ids.filtered( lambda x: x.product_id == self.product_id and - not x.origin_returned_move_id).mapped("product_uom_qty")) + not x.origin_returned_move_id and + ( + x.state != "cancel" or ( + x.state == "cancel" and x.backorder_id + ) + ) + ).mapped("product_uom_qty") + ) return component_demand / sale_line.product_uom_qty