diff options
| -rw-r--r-- | addons/stock/static/src/js/popover_widget.js | 25 | ||||
| -rw-r--r-- | addons/stock/views/stock_orderpoint_views.xml | 2 |
2 files changed, 11 insertions, 16 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); }, diff --git a/addons/stock/views/stock_orderpoint_views.xml b/addons/stock/views/stock_orderpoint_views.xml index 7483beeef3f..320e1f4c6b0 100644 --- a/addons/stock/views/stock_orderpoint_views.xml +++ b/addons/stock/views/stock_orderpoint_views.xml @@ -48,12 +48,12 @@ <field name="warehouse_id" options="{'no_create': True}" groups="stock.group_stock_multi_warehouses" optional="hide"/> <field name="qty_on_hand" force_save="1"/> <field name="qty_forecast" force_save="1"/> + <field name="json_lead_days_popover" optional="show" nolabel="1" string="Forecast Description" width="10px" widget="popover_widget" attrs="{'invisible': [('id', '=', False)]}"/> <field name="route_id" options="{'no_create': True, 'no_open': True}"/> <field name="trigger" optional="hide"/> <field name="product_min_qty" optional="show"/> <field name="product_max_qty" optional="show"/> <field name="qty_multiple" optional="hide"/> - <field name="json_lead_days_popover" optional="show" nolabel="1" string="Forecast Description" width="10px" widget="popover_widget" attrs="{'invisible': [('id', '=', False)]}"/> <field name="qty_to_order"/> <field name="product_uom_name" string="UoM" groups="uom.group_uom"/> <field name="company_id" optional="hide" readonly="1" groups="base.group_multi_company"/> |
