Skip to content

Commit 74966b7

Browse files
committed
[IMP] website_sale_product_brand: add option to show brands without published products
1 parent 3698cc9 commit 74966b7

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

website_sale_product_brand/controllers/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ def _build_brands_list(
117117
request.env["product.brand"]
118118
.sudo()
119119
.search(domain)
120-
.filtered(lambda x: x.published_products_count > 0)
120+
.filtered(
121+
lambda x: x.published_products_count > 0
122+
or x.show_without_published_products
123+
)
121124
)
122125

123126
def _get_shop_domain_no_brands(
@@ -356,7 +359,10 @@ def product_brands(self, **post):
356359
brand_rec = (
357360
b_obj.sudo()
358361
.search(domain)
359-
.filtered(lambda x: x.published_products_count > 0)
362+
.filtered(
363+
lambda x: x.published_products_count > 0
364+
or x.show_without_published_products
365+
)
360366
)
361367

362368
keep = QueryURL("/page/product_brands", brand_id=[])

website_sale_product_brand/models/product_brand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ProductBrand(models.Model):
1616
website_footer = fields.Html(translate=True)
1717
show_brand_name = fields.Boolean(default=True)
1818
show_brand_description = fields.Boolean(default=True)
19+
show_without_published_products = fields.Boolean(default=False)
1920
align_brand_content = fields.Selection(
2021
selection=[
2122
("left", "Left"),

website_sale_product_brand/views/product_brand_views.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<field name="website_published" />
2222
<field name="show_brand_name" />
2323
<field name="show_brand_description" />
24+
<field name="show_without_published_products" />
2425
<field name="align_brand_content" />
2526
</group>
2627
<group>

0 commit comments

Comments
 (0)