[19.0][MIG]: website_sale_product_brand#1181
Conversation
7c14e54 to
af31ea6
Compare
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
website_sale_product_brand 13.0.1.1.1
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
bffb12b to
17cabcf
Compare
|
This PR has the |
|
@OCA/e-commerce-maintainers Please, can you review/merge this PR? |
17cabcf to
8799077
Compare
8799077 to
c9d1af4
Compare
Ricardoalso
left a comment
There was a problem hiding this comment.
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) | |||
There was a problem hiding this comment.
is_published is already defined in website.published.mixin
There was a problem hiding this comment.
@Ricardoalso I think wants to add the default=True to the field. I deleted this and added _default_is_published to True
| brand_rec = ( | ||
| b_obj.sudo() | ||
| .search(domain) | ||
| .filtered(lambda x: x.published_products_count > 0) |
There was a problem hiding this comment.
published_products_count > 0 can be added to the domain
There was a problem hiding this comment.
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 🙏
There was a problem hiding this comment.
I opened a PR #1204 with the feature "brand landing page"
There was a problem hiding this comment.
@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?
There was a problem hiding this comment.
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
c9d1af4 to
c0eb27e
Compare
|
@Ricardoalso I'm not entirely clear on which commits should be squashed. |
c0eb27e to
1140edc
Compare
I was thinking about 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 |
1140edc to
0464388
Compare
|
@Ricardoalso done! Could you check it now? |
Thanks for the rebase @Alexgars73 🙏 Could you check my comment #1181 (comment)? |
…ct_brand [19.0][MIG]: website_sale_product_brand
| 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), | ||
| ] | ||
| ) |
There was a problem hiding this comment.
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)
| import {patch} from "@web/core/utils/patch"; | ||
|
|
||
| patch(WebsiteSale.prototype, { | ||
| onChangeAttribute(ev) { |
There was a problem hiding this comment.
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])], |
There was a problem hiding this comment.
| "group_ids": [(6, 0, [cls.env.ref("base.group_portal").id])], | |
| "group_ids": [Command.set([cls.env.ref("base.group_portal").id])], |
Added to prevent the product brand from being displayed in website filters if the brand does not have any published products.