[FIX] stock: Don't try to load reports from unselected companies

If we have two companies A and B with B selected and we try to access the Forecast Report via a product, company A's warehouse is automatically selected, which of course creates a security error.

This fix modifies the ´get_warehouses´ method in order to return only the warehouses whose company is selected.

opw-2688135

closes odoo/odoo#80021

X-original-commit: 088e97aa3214578de99abbd47bd6aeccff244855
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
This commit is contained in:
Achraf (abz)
2021-11-18 15:11:26 +00:00
parent e8c15bf2bb
commit 612b705975
@@ -35,6 +35,7 @@ const ReplenishReport = clientAction.extend({
var loadWarehouses = this._rpc({
model: 'report.stock.report_product_product_replenishment',
method: 'get_warehouses',
context: this.context,
}).then((res) => {
this.warehouses = res;
if (this.context.warehouse) {