From 187b77d7b9fd7ccbd3d09aeb193fe896de98c161 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 14 Jun 2019 08:05:33 +0000 Subject: [PATCH] [FIX] product: report pricelist empty data Try to get the report_pricelist with empty data (Studio Report editor can) Before this commit, it crashes because we tried to access dict keys directly in an empty dict After this commit, it doesn't crash OPW 2009862 closes odoo/odoo#34118 Signed-off-by: Lucas Perais (lpe) --- addons/product/report/product_pricelist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index c0bd5138fab..8a82ceb70ab 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -27,7 +27,8 @@ class report_product_pricelist(models.AbstractModel): } def _get_quantity(self, data): - return sorted([data['form'][key] for key in data['form'] if key.startswith('qty') and data['form'][key]]) + form = data and data.get('form') or {} + return sorted([form[key] for key in form if key.startswith('qty') and form[key]]) def _get_categories(self, pricelist, products, quantities): categ_data = []