summaryrefslogtreecommitdiff
path: root/addons/stock/static
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2020-09-04 10:04:24 +0000
committersvs-odoo <svs@odoo.com>2020-10-02 07:18:33 +0000
commit36af5e95eddaa18886c9584865e5620494c93e16 (patch)
tree95664c7ecdd9bb6d7d69cb6c4f8a6f531ca4604e /addons/stock/static
parent6063bf7576a0abf975c2668ebacb6ad68c24315e (diff)
[IMP] stock: popover widget new forecasted report
In the replenishment view, the popover widget allows to open the product forecasted report. Before this commit, it opened only the forecasted report graph. Now it opens the new forecasted report (graph + operations table). Also, moves the widget next to the forecast qty field. task-2328830
Diffstat (limited to 'addons/stock/static')
-rw-r--r--addons/stock/static/src/js/popover_widget.js25
1 files changed, 10 insertions, 15 deletions
diff --git a/addons/stock/static/src/js/popover_widget.js b/addons/stock/static/src/js/popover_widget.js
index c31b32a39e0..82335cfdcba 100644
--- a/addons/stock/static/src/js/popover_widget.js
+++ b/addons/stock/static/src/js/popover_widget.js
@@ -50,8 +50,7 @@ var PopoverWidgetField = AbstractField.extend({
},
/**
- * Redirect to the product graph view.
- * (Based off of qty_at_date_widget.js method)
+ * Redirect to the product forecasted report.
*
* @private
* @param {MouseEvent} event
@@ -59,20 +58,16 @@ var PopoverWidgetField = AbstractField.extend({
*/
async _openForecast(ev) {
ev.stopPropagation();
- // Change action context to choose a specific date and product(s)
- // As grid_anchor is set to now() by default in the data, we need
- // to load the action first, change the context then launch it via do_action
- // additional_context cannot replace a context value, only add new
- const action = await data_manager.load_action('stock.report_stock_quantity_action_product');
- const additional_context = {
- grid_anchor: this.recordData.delivery_date_grid,
- search_default_warehouse_id: [this.recordData.warehouse_id.data.id],
- search_default_below_warehouse: false
+ const reportContext = {
+ active_model: 'product.product',
+ active_id: this.recordData.product_id.data.id,
};
- action.context = new Context(action.context, additional_context);
- action.domain = [
- ['product_id', '=', this.recordData.product_id.data.id]
- ];
+ const action = await this._rpc({
+ model: reportContext.active_model,
+ method: 'action_product_forecast_report',
+ args: [[reportContext.active_id]],
+ });
+ action.context = new Context(action.context, reportContext);
return this.do_action(action);
},