Skip to content

[19.0][MIG]: website_sale_product_brand#1181

Open
Alexgars73 wants to merge 34 commits into
OCA:19.0from
Studio73:19.0-mig-website_sale_product_brand
Open

[19.0][MIG]: website_sale_product_brand#1181
Alexgars73 wants to merge 34 commits into
OCA:19.0from
Studio73:19.0-mig-website_sale_product_brand

Conversation

@Alexgars73
Copy link
Copy Markdown

@Alexgars73 Alexgars73 commented Mar 16, 2026

Added to prevent the product brand from being displayed in website filters if the brand does not have any published products.

@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch 5 times, most recently from 7c14e54 to af31ea6 Compare March 16, 2026 15:24
Copy link
Copy Markdown

@Reyes4711-S73 Reyes4711-S73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Functional review OK

MeetSCS and others added 22 commits March 17, 2026 09:14
OCA Transbot updated translations from Transifex
[ADD][website_sale_wishlist] Wishlist for your online shop.

Allow your visitors and users to wishlist your products and have a shortcut for seeing them.

Wishlisted products are stored in the session for public users, and linked to the user if s/he is logged in.

OCA Transbot updated translations from Transifex
OCA Transbot updated translations from Transifex
[UPD] Update website_sale_product_brand.pot

[UPD] README.rst

Translated using Weblate (Persian)

Currently translated at 100.0% (5 of 5 strings)

Translation: e-commerce-11.0/e-commerce-11.0-website_sale_product_brand
Translate-URL: https://translation.odoo-community.org/projects/e-commerce-11-0/e-commerce-11-0-website_sale_product_brand/fa/
website_sale_product_brand 12.0.1.1.0
[UPD] Update website_sale_product_brand.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: e-commerce-13.0/e-commerce-13.0-website_sale_product_brand
Translate-URL: https://translation.odoo-community.org/projects/e-commerce-13-0/e-commerce-13-0-website_sale_product_brand/

pre-commit update
Currently translated at 100.0% (5 of 5 strings)

Translation: e-commerce-13.0/e-commerce-13.0-website_sale_product_brand
Translate-URL: https://translation.odoo-community.org/projects/e-commerce-13-0/e-commerce-13-0-website_sale_product_brand/pt_BR/
Currently translated at 100.0% (5 of 5 strings)

Translation: e-commerce-13.0/e-commerce-13.0-website_sale_product_brand
Translate-URL: https://translation.odoo-community.org/projects/e-commerce-13-0/e-commerce-13-0-website_sale_product_brand/nl/
Currently translated at 100.0% (5 of 5 strings)

Translation: e-commerce-13.0/e-commerce-13.0-website_sale_product_brand
Translate-URL: https://translation.odoo-community.org/projects/e-commerce-13-0/e-commerce-13-0-website_sale_product_brand/ca/
Currently translated at 100.0% (5 of 5 strings)

Translation: e-commerce-14.0/e-commerce-14.0-website_sale_product_brand
Translate-URL: https://translation.odoo-community.org/projects/e-commerce-14-0/e-commerce-14-0-website_sale_product_brand/es_AR/
Before this patch, images were deformed if they didn't meet precise
proportions.

TT34753
- Allow to hide brands from the e-commerce
- Added brand configuration menu for the case `sale_management` app
isn't installed.
- Updated README
@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch 8 times, most recently from bffb12b to 17cabcf Compare March 17, 2026 11:51
@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@Reyes4711-S73
Copy link
Copy Markdown

@OCA/e-commerce-maintainers Please, can you review/merge this PR?

@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch from 17cabcf to 8799077 Compare March 24, 2026 10:46
@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch from 8799077 to c9d1af4 Compare March 31, 2026 13:36
Copy link
Copy Markdown

@Ricardoalso Ricardoalso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you squash commits following the rules defined in https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests ? 🙏

@@ -8,3 +8,15 @@ class ProductBrand(models.Model):
_inherit = ["product.brand", "website.published.mixin"]

is_published = fields.Boolean(default=True)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_published is already defined in website.published.mixin

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ricardoalso I think wants to add the default=True to the field. I deleted this and added _default_is_published to True

Comment thread website_sale_product_brand/controllers/main.py Outdated
brand_rec = (
b_obj.sudo()
.search(domain)
.filtered(lambda x: x.published_products_count > 0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

published_products_count > 0 can be added to the domain

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ricardoalso i think not it's a compute

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it's a computed and stored field. Not searchable as-is 👍

This leads me to question the utility of filtering on published_products_count > 0 🤔

It wasn't the case in previous versions, and doing so will exclude brands from the website even if we want to display a landing (for example) page for brands we have but have not yet configured any product.template for. I am currently working on such improvements (product brand landing page), and with this business case it makes more sense to display all brands even if no product.template is associated. What do you think? Did you have any specific technical or business need or issue that led you to implement this filter on published_products_count > 0?

Thanks in advance for your input 🙏

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened a PR #1204 with the feature "brand landing page"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ricardoalso We were looking into it and saw the need to make that improvement because I think it makes perfect sense; why publish a brand if there isn't an active product yet?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can make sense in the current state indeed. I will add a configuration in my PR where I add the brand "landing pages" feature

Thanks for you feedback

@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch from c9d1af4 to c0eb27e Compare May 4, 2026 15:38
@OCA-git-bot OCA-git-bot added series:19.0 mod:website_sale_product_brand Module website_sale_product_brand labels May 4, 2026
@Alexgars73
Copy link
Copy Markdown
Author

@Ricardoalso I'm not entirely clear on which commits should be squashed.

@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch from c0eb27e to 1140edc Compare May 4, 2026 15:45
@Ricardoalso
Copy link
Copy Markdown

@Ricardoalso I'm not entirely clear on which commits should be squashed.

I was thinking about the commits generated by bots or Weblate
https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests#mergesquash-the-commits-generated-by-bots-or-weblate

I see at least 4 commits oca-* bot authored; for example 0497497

And all the weblate translation commits are related to the module website_sale_product_brand [MIG] website_sale_product_brand: Migration to version 18.0. You can fixup all commits below it

@Alexgars73 Alexgars73 force-pushed the 19.0-mig-website_sale_product_brand branch from 1140edc to 0464388 Compare May 11, 2026 07:26
@Alexgars73
Copy link
Copy Markdown
Author

@Ricardoalso done! Could you check it now?

@Ricardoalso
Copy link
Copy Markdown

@Ricardoalso done! Could you check it now?

Thanks for the rebase @Alexgars73 🙏

Could you check my comment #1181 (comment)?

Ricardoalso added a commit to camptocamp/e-commerce that referenced this pull request May 11, 2026
…ct_brand

[19.0][MIG]: website_sale_product_brand
Comment on lines +17 to +24
def _compute_published_products_count(self):
for brand in self:
brand.published_products_count = self.env["product.template"].search_count(
[
("product_brand_id", "=", brand.id),
("website_published", "=", True),
]
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth to reuse the same way products are counted in the product_brand module for performance reason:
https://github.com/OCA/brand/blob/0cb061b0b1014d201b27d3d3c44623f37725ce0f/product_brand/models/product_brand.py#L32-L42
Something like:

@api.depends("product_ids")
def _compute_published_products_count(self):
    product_model = self.env["product.template"]
    groups = product_model._read_group(
        [("product_brand_id", "in", self.ids), ("website_published", "=", True)],
        ["product_brand_id"],
        ["product_brand_id:count"],
    )
    data = {group[0].id: group[1] for group in groups}
    for brand in self:
        brand.published_products_count = data.get(brand.id, 0)

Copy link
Copy Markdown

@vvrossem vvrossem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution 🎉

import {patch} from "@web/core/utils/patch";

patch(WebsiteSale.prototype, {
onChangeAttribute(ev) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add some comments explaining what this function does

"login": login,
"password": login,
"email": "portal_brand@example.com",
"group_ids": [(6, 0, [cls.env.ref("base.group_portal").id])],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"group_ids": [(6, 0, [cls.env.ref("base.group_portal").id])],
"group_ids": [Command.set([cls.env.ref("base.group_portal").id])],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.