[FIX] stock: add active model in report context
Steps to reproduce: ------------------- - create a storable product and set a quantity on hand - create a delivery for this product and set to draft - add a demand for this product on the delivery - click on "Mark as Todo" - go to the product form - click on the Forecasted smart button - click on "Unreserve" button (to process business logic ans reload report) Issue: ------ The report is reloaded with all products. Cause: ------ When we setup/start the `StockForecasted` component, if we can't find an active model in the action's context, we try to find it in the action's props (via res_model or on the original action if necessary). If the original action is used, the active model must be in the context of the original action. Unfortunately, this is not the case. Without `resModel` the domain determined in the `graphDomain` method will not filter on the product (which corresponds to the `active_id`). Solution: --------- If no resModel is found via the context, add it to the context when it is determined. Add the action id to handle the case of reloading the page directly via the browser's refresh button. opw-3793065 closes odoo/odoo#161569 X-original-commit: 288e1e0f8d7bc343b90a22692bdf44ccb9b21725 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -63,6 +63,7 @@ export class StockForecasted extends Component {
|
||||
this.resModel = originalContextAction.active_model;
|
||||
}
|
||||
}
|
||||
this.context.active_model = this.resModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +77,7 @@ export class StockForecasted extends Component {
|
||||
|
||||
async reloadReport() {
|
||||
const actionRequest = {
|
||||
id: this.props.action.id,
|
||||
type: "ir.actions.client",
|
||||
tag: "stock_forecasted",
|
||||
context: this.context,
|
||||
|
||||
Reference in New Issue
Block a user