From 8415431373d4fd9380005a29db52d03a4115ec1c Mon Sep 17 00:00:00 2001 From: bosd Date: Fri, 16 May 2025 17:50:29 +0200 Subject: [PATCH] [IMP] brand: Ensure `company_id` default Defaults the `company_id` field on the `product.pricelist.print` wizard to `self.env.company`. This ensures that the `brand_use_level` field (which is related to `company_id.brand_use_level`) is correctly computed upon wizard initialization. Consequently, the brand requirement checks (Python constraints like `_check_brand_requirement`) and UI adjustments (dynamic 'required' or 'invisible' attributes on `brand_id` field via `_get_view`) inherited from the `res.brand.mixin` can function as intended. Without this explicit default, the mixin's logic might not have the correct company context immediately upon wizard load, potentially leading to brand requirement rules not being enforced as expected. --- brand/models/res_brand_mixin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/brand/models/res_brand_mixin.py b/brand/models/res_brand_mixin.py index 55ea2a696..6eb6ad323 100644 --- a/brand/models/res_brand_mixin.py +++ b/brand/models/res_brand_mixin.py @@ -23,6 +23,7 @@ class ResBrandMixin(models.AbstractModel): ) company_id = fields.Many2one( comodel_name="res.company", + default=lambda self: self.env.company, ) is_brand_required = fields.Boolean( compute="_compute_is_brand_required",