From 35b46e06b364473f01bf828150e7fc71e59a3800 Mon Sep 17 00:00:00 2001 From: Unai Beristain Date: Mon, 9 Sep 2024 09:10:19 +0200 Subject: [PATCH] [IMP] mrp_stock_move_cost: Improve ValueError: Expected singleton --- mrp_stock_move_cost/models/stock_move_line.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mrp_stock_move_cost/models/stock_move_line.py b/mrp_stock_move_cost/models/stock_move_line.py index bd96ba234..e0c5bd27f 100644 --- a/mrp_stock_move_cost/models/stock_move_line.py +++ b/mrp_stock_move_cost/models/stock_move_line.py @@ -31,8 +31,10 @@ def create(self, vals_list): def write(self, vals): result = super().write(vals) - if self and "qty_done" in vals and self.state == "done": - self.search_production_and_update() + if "qty_done" in vals: + self.filtered( + lambda line: line.state == "done" + ).search_production_and_update() return result def search_production_and_update(self):