Skip to content

[16.0][FIX] brand: Enable overloading of res.brand.mixin views#289

Open
emiliesoutiras wants to merge 1 commit intoOCA:16.0from
Groupe-Voltaire-SAS:16.0-brand_fix_get_view
Open

[16.0][FIX] brand: Enable overloading of res.brand.mixin views#289
emiliesoutiras wants to merge 1 commit intoOCA:16.0from
Groupe-Voltaire-SAS:16.0-brand_fix_get_view

Conversation

@emiliesoutiras
Copy link
Copy Markdown

With the get_view() function in the res.brand.mixin template, all view overrides for the brand_id field are systematically overwritten by the Python definition of the field.

As a result, the sale_brand.view_order_form_brand view is useless because the definition of the SaleOrder.brand_id field already sets it to read-only in all states other than ‘draft’.

This proposal intends to make the "readonly" attribute of the brand_id field in views overridable via a Python function.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @sbejaoui,
some modules you are maintaining are being modified, check this out!

@emiliesoutiras emiliesoutiras force-pushed the 16.0-brand_fix_get_view branch from 811e8e3 to dd93417 Compare January 21, 2026 14:20
@emiliesoutiras
Copy link
Copy Markdown
Author

cc @Kev-Roche @metaminux

Copy link
Copy Markdown

@Kev-Roche Kev-Roche left a comment

Choose a reason for hiding this comment

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

Functional review LGTM

Copy link
Copy Markdown

@marcos-mendez marcos-mendez left a comment

Choose a reason for hiding this comment

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

Automated Review -- Tests Passed

All tests for brand passed successfully on Odoo 16.0.
Environment: Minikube + K8s Job + oca-ci/py3.10-odoo16.0


Automated review by OCA PR Reviewer + qwen3-coder:30b

Copy link
Copy Markdown

@marcos-mendez marcos-mendez left a comment

Choose a reason for hiding this comment

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

Automated Review -- Tests Passed

All tests for brand passed successfully on Odoo 16.0.
Environment: Minikube + K8s Job + oca-ci/py3.10-odoo16.0


Test Coverage Suggestions

Coverage gaps

The new methods _get_brand_id_readonly_domain() and is_brand_id_field() are introduced but not tested. The logic in setup_modifiers() that handles the readonly domain extension is also not directly tested — especially the case where modifiers["readonly"] is a list vs a single domain.

Suggested test cases

def test_setup_modifiers_readonly_domain_extension(self):
    """Test that readonly domain is correctly extended when brand_id field is present."""
    # Create a record and simulate setup_modifiers call
    # Assert that readonly domain is extended properly when _get_brand_id_readonly_domain returns a domain

def test_is_brand_id_field_returns_correctly(self):
    """Test that is_brand_id_field correctly identifies brand_id field."""
    # Call is_brand_id_field with brand_id and other fields
    # Assert correct boolean return values

def test_get_brand_id_readonly_domain_returns_domain(self):
    """Test that _get_brand_id_readonly_domain returns a proper domain or False."""
    # Override _get_brand_id_readonly_domain to return a domain
    # Assert that it's correctly handled in setup_modifiers

Codecov risk

  • _get_brand_id_readonly_domain() returns False by default, so it may not be tested if no subclass overrides it.
  • is_brand_id_field() is a helper that could be tested for correctness, especially if used in multiple places.
  • setup_modifiers() logic involving expression.OR is not covered, especially in list vs non-list readonly cases.

Recommendation: Add tests for these specific logic branches to ensure full coverage.


⏰ This PR has been open for 51 days.

Every ignored PR is a contributor who might not come back. Review time matters. (OCA Aging Report)


Reciprocal Review Request

Hi everyone! Thanks for your contribution to OCA. I reviewed and approved this PR. If any of you have a moment, I would really appreciate a review on my open PR(s):

My open PRs across OCA:

Reviewing each other's work helps the whole community move forward faster. Thank you!


Automated review by OCA Neural Reviewer + qwen3-coder:30b

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants