[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) <whe@odoo.com>
This commit is contained in:
althaf shaik
2023-03-21 18:56:12 +01:00
parent 87821818ee
commit 6273ac721c
+3 -3
View File
@@ -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",