[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) <lpe@odoo.com>
This commit is contained in:
Lucas Perais (lpe)
2019-06-14 08:05:33 +00:00
parent 66e2aeb660
commit 187b77d7b9
+2 -1
View File
@@ -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 = []