Skip to content
Snippets Groups Projects
Commit de6b1636 authored by Nasreddin Boulif (bon)'s avatar Nasreddin Boulif (bon)
Browse files

[FIX] stock: use docids as product_id in report


Steps to reproduce:

  - Install Inventory and Studio modules
  - Go to Inventory -> Products -> Products
  - Open Studio
  - Click on Reports tab
  - Select `Product Routes Report`

Issue:

  Traceback is raised.

Cause:

  No 'product_id' provided in data while getting report values.

Solution:

  If no `product_id` key or value in data, set `docids` (or an empty
  list if no docids) as product_id and set 'warehouse_ids'
  to an empty list.

opw-2619142

closes odoo/odoo#74860

Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
parent c427539a
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,10 @@ class ReportStockRule(models.AbstractModel):
@api.model
def _get_report_values(self, docids, data=None):
# Overriding data values here since used also in _get_routes.
data['product_id'] = data.get('product_id', docids)
data['warehouse_ids'] = data.get('warehouse_ids', [])
product = self.env['product.product'].browse(data['product_id'])
warehouses = self.env['stock.warehouse'].browse(data['warehouse_ids'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment