From 6273ac721c9296cd753cfd3cb9701128eb07bb3a Mon Sep 17 00:00:00 2001 From: althaf shaik Date: Mon, 20 Mar 2023 06:00:48 +0000 Subject: [PATCH] [FIX] stock: getting value from context in inventory Attribute Error: 'frozendict' object has no attribute 'default_product_id' trace back that occurs in stock/stock_quant: action_inventory_at_date was caught by sentry. steps to produce:- Install inventory module Select any product from menuitem/reporting/stock Click replinish button & from that replinish wizard, select the product again Then click forecasted stat button and in forecast click On Hand button Then click Inventory At Date. At this moment you find a trace back. Because default_product_id is not getting from context in inventory. sentry:-3952193922 closes odoo/odoo#115946 X-original-commit: 53445511294b5dfb27d626bf0039eba7e7ad54f2 Signed-off-by: William Henrotin (whe) --- addons/stock/models/stock_quant.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index f1c696426f8..73d037efcc4 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -446,9 +446,9 @@ class StockQuant(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",