From 3aee7a8cc8cb0dbba1f1fa53e8c681494e7a3d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nshimiyimana=20S=C3=A9na?= Date: Mon, 25 Jul 2022 08:31:57 +0000 Subject: [PATCH] [FIX] stock: count request sets the wrong user Steps to reproduce: - go to Inventory > Operations > Inventory Adjustments - Select at least one product - Click on Request a count; A dialog box containing a form should appear - Select a user other than the current user - Make sure to check "Set Current Value" - Click "Confirm" You should see that the user you selected is not the one assigned for the count. Instead, the count is assigned to the current user. This is happening because currently, calling `action_set_inventory_quantity` also sets the user as the current one if the quantity is not already set. opw-2924694 closes odoo/odoo#96914 X-original-commit: f2b79bc4c6198aacca33eea8905fd62c629706a1 Signed-off-by: Tiffany Chang --- addons/stock/wizard/stock_request_count.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/wizard/stock_request_count.py b/addons/stock/wizard/stock_request_count.py index 09298d2bd45..f1099208170 100644 --- a/addons/stock/wizard/stock_request_count.py +++ b/addons/stock/wizard/stock_request_count.py @@ -18,10 +18,10 @@ class StockRequestCount(models.TransientModel): def action_request_count(self): for count_request in self: - count_request.quant_ids.with_context(inventory_mode=True).write( - count_request._get_values_to_write()) if count_request.set_count == 'set': count_request.quant_ids.filtered(lambda q: not q.inventory_quantity_set).action_set_inventory_quantity() + count_request.quant_ids.with_context(inventory_mode=True).write( + count_request._get_values_to_write()) def _get_values_to_write(self): values = {