Skip to Content

PMIS Website Sale Product Brand Fix

License: AGPL-3 PMISuite/website Version: 18.0

Controller bridge for Odoo 18, OCA's website_sale_product_brand, and pmis_website_sale_core. It prevents brand postprocessing from assuming every shop response contains the catalog context, including attrib_values.

Installation and Scope

The addon depends on website_sale, website_sale_product_brand, and pmis_website_sale_core. Its manifest sets auto_install=True: keep it on the addons path so Odoo can install it when these dependencies are installed. Theme PMISuite itself is not a dependency.

There are no settings, models, views, asset bundles, or data files. The only behavior change is in controllers/main.py. The bridge provides guarded response handling for the active OCA brand catalog.

Usage

Configure product brands in OCA's inherited interface and browse the shop or brand listing. Brand selections and attribute filters remain available through the inherited pages. Redirects and responses without catalog context pass through without brand postprocessing. There is no separate user action to run the fix after installation.

Response Contract

  1. A numeric route brand value initializes the request's brand_id context before the downstream shop call, without replacing an existing value.

  2. The downstream shop executes once. Exceptions are propagated, not swallowed or retried.

  3. Redirects, non-QWeb responses, non-dictionary contexts, and contexts without products pass through unchanged.

  4. For a catalog response, an existing attrib_values value is preserved, including an empty list. Only a missing key is reconstructed from repeated attribute_value=<attribute_id>-<value_id> query parameters.

  5. OCA helpers build and filter the brand list. The bridge supplies selected_brand_ids, attr_valid, and a filter-preserving keep URL, retaining both brand and brand_ids query aliases.

Malformed numeric brand filters or reconstructed attribute pairs raise HTTP 400 (BadRequest). ORM searches use the current request environment; this bridge does not add sudo() or introduce a new brand-access policy.

Why the Delegation Is Unusual

OCA's shop() accesses its response context before returning. Guarding only the result of a normal super().shop() call would be too late.

The module-level _shop_without_brand_postprocessing() helper starts method resolution immediately after OCA's BrandWebsiteSale class. The bridge then performs guarded brand postprocessing itself. Other OCA methods remain inherited, including brand-domain filtering and the brand-listing route.

The brand-listing route is republished with sitemap=True and delegates to OCA's renderer. This keeps /page/product_brands in the sitemap without the missing-sitemap warning.

Do not replace this delegation with a direct call to Odoo's core shop method: that could skip other controller extensions. Do not catch KeyError and retry the request: unrelated failures must remain visible and side effects must not run twice. No upstream class is monkey-patched by this implementation.

The PMIS Theme Base shop override also returns non-catalog responses before recording search analytics.

Maintenance

On an OCA upgrade, compare its shop() implementation and inherited helper signatures with this replacement. Remove the bridge only when the upstream response contract makes it unnecessary.

Module Name and Repository

The technical name remains pmis_website_sale_product_brand_fix. The addon lives in website alongside pmis_theme_base and theme_pmisuite. Keep purchased on addons_path while legacy compatibility shells remain installed. Use -u all for ordinary updates; the one-time theme rename is no longer included.

Bug Tracker

Bugs are tracked on PMISuite Repository Issues.

Credits

Authors

  • PMIverse

Contributors

  • Matjaž Mozetič

Maintainers

LUXIM MATMOZ

Current maintainer:

sysadminmatmoz

Luxim is an independent R&D and deployment company focused on solving complex problems in the Odoo ecosystem.

Odoo Community Association

Luxim is an active member of OCA (Odoo Community Association).