[FIX] product: expand group on categories only when needed

Issue: on main product's kanban, if you group by categories, all
categories (even the empty ones) appear. This is not desired.

We only wanted this group_expand logic when using the products stat
button on the product category form view.

closes odoo/odoo#46966

X-original-commit: e3f1254e5b28aa801f137835d871427786fb3428
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Simon Lejeune
2020-03-05 12:25:06 +00:00
parent a5dccc1586
commit 53e89e5006
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ class ProductTemplate(models.Model):
def _read_group_categ_id(self, categories, domain, order):
category_ids = self.env.context.get('default_categ_id')
if not category_ids:
if not category_ids and self.env.context.get('group_expand'):
category_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
return categories.browse(category_ids)
+1 -1
View File
@@ -448,7 +448,7 @@
name="%(product_template_action_all)d"
icon="fa-th-list"
type="action"
context="{'search_default_categ_id': active_id, 'default_categ_id': active_id}">
context="{'search_default_categ_id': active_id, 'default_categ_id': active_id, 'group_expand': True}">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="product_count"/></span>
<span class="o_stat_text"> Products</span>