Skip to content
Snippets Groups Projects
Commit 464c8584 authored by Touati Djamel (otd)'s avatar Touati Djamel (otd)
Browse files

[FIX] stock: access the forecast report from an SOL

Steps to reproduce the bug:
- Installe `sale_stock`
- Create a storable product “P1”
- Create a SO:
    - Add the product “P1”
    - Save
    - click on `See the Forecasted View.`

Problem:
A User error is triggered `”Record does not exist or has been deleted.
(Record: product.template(43,), User: 2)”`

Because the id of `product.product` is used in the model
`product.template`

When the button is clicked,
https://github.com/odoo/odoo/blob/73155293d503e3a9dd65898b8e1ac489e279c33c/addons/sale_stock/static/src/widgets/qty_at_date_widget.xml#L63

The `openForecast` function on the js side is triggered, the correct
report and model are set:

https://github.com/odoo/odoo/blob/73155293d503e3a9dd65898b8e1ac489e279c33c/addons/sale_stock/static/src/widgets/qty_at_date_widget.js#L16-L19

Then, the `_getReportValues` function is triggered, in which we check
if it is a template or a variant. So we get the `active.model` from the
context

https://github.com/odoo/odoo/blob/e176ba0b77aa692c16160a1e7bf471e19719e3fb/addons/stock/static/src/stock_forecasted/stock_forecasted.js#L40

but then we set the `res.model` to false, because `original_action` is
not false and `originalContextAction` has no `active.model`

https://github.com/odoo/odoo/blob/e176ba0b77aa692c16160a1e7bf471e19719e3fb/addons/stock/static/src/stock_forecasted/stock_forecasted.js#L46-L49

so :

https://github.com/odoo/odoo/blob/e176ba0b77aa692c16160a1e7bf471e19719e3fb/addons/stock/static/src/stock_forecasted/stock_forecasted.js#L52


Will be true

opw-3100964

closes odoo/odoo#108113

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 402b6e98
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment