[FIX] stock: history back on the forecast report

Steps to reproduce:

  - Go to stock > Replenishment
  - Click on a forecast report widget
  - Go back using the browser arrows
  -> The page is redirected to another forecast report and the
  breadcrumbs are cleared

Cause of the issue:

  The forecast report action uses the `window.history.pushState` to
  add the active model in the url.
  When going back, the new url is the same one but without the active
  model.
  We can get the correct behavior by doing `window.history.go(-2)` in
  the console.

Solution:

  Use `history.replaceState` instead

opw-2917725

closes odoo/odoo#96487

X-original-commit: b39dc5488bacb704aaa60f1a502bf005d57f3276
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
This commit is contained in:
Hubert Van de Walle (huvw)
2022-07-21 01:53:47 +02:00
parent c21101c161
commit 96c2716674
@@ -101,7 +101,7 @@ const ReplenishReport = clientAction.extend({
// Hack to put the res_model on the url. This way, the report always know on with res_model it refers.
if (location.href.indexOf('active_model') === -1) {
const url = window.location.href + `&active_model=${this.resModel}`;
window.history.pushState({}, "", url);
window.history.replaceState({}, "", url);
}
},