From 113d9f1d8d8911c594320b91b5fef879d7fac6dc Mon Sep 17 00:00:00 2001 From: uso-odoo Date: Thu, 11 May 2023 12:47:42 +0000 Subject: [PATCH] [FIX] stock_account: getting value from context in stock valuation layer Attribute Error: 'frozendict' object has no attribute 'default_product_id' traceback that occurs in stock/stock_quant: action_inventory_at_date was caught by a sentry. steps to produce:- - Install inventory module - Select any product from the menu item/reporting/stock - Click replenish button & from that replenish wizard, select the product again - Then click the forecasted stat button and in forecast click the On Hand button - Then click Inventory At Date. At this moment you find a traceback. Because default_product_id is not getting from the context in inventory. Applying these changes will resolve this issue. sentry:-4148733813 closes odoo/odoo#122741 X-original-commit: ca58b13d63702ac2ec8d74b855b90058bf18eb7b Signed-off-by: William Henrotin (whe) --- addons/stock_account/models/stock_valuation_layer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_account/models/stock_valuation_layer.py b/addons/stock_account/models/stock_valuation_layer.py index c4773f2caf9..aeb94bcaf5b 100644 --- a/addons/stock_account/models/stock_valuation_layer.py +++ b/addons/stock_account/models/stock_valuation_layer.py @@ -78,9 +78,9 @@ class StockValuationLayer(models.Model): # inventory at a given date. context = {} if ("default_product_id" in self.env.context): - context.product_id = self.env.context.default_product_id - elif ("product_tmpl_id" in self.env.context): - context.product_tmpl_id = self.env.context.product_tmpl_id + context["product_id"] = self.env.context["default_product_id"] + elif ("default_product_tmpl_id" in self.env.context): + context["product_tmpl_id"] = self.env.context["default_product_tmpl_id"] return { "res_model": "stock.quantity.history",