Skip to content

Commit

Permalink
[FIX] product: expand group on categories only when needed
Browse files Browse the repository at this point in the history
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#46950

Signed-off-by: Simon Lejeune (sle) <[email protected]>
  • Loading branch information
sle-odoo committed Mar 5, 2020
1 parent 6349b54 commit e3f1254
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/product/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_default_volume_uom(self):

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)

Expand Down
2 changes: 1 addition & 1 deletion addons/product/views/product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,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>
Expand Down

0 comments on commit e3f1254

Please sign in to comment.