[16.0][FIX] brand: Enable overloading of res.brand.mixin views#289
[16.0][FIX] brand: Enable overloading of res.brand.mixin views#289emiliesoutiras wants to merge 1 commit intoOCA:16.0from
Conversation
|
Hi @sbejaoui, |
811e8e3 to
dd93417
Compare
marcos-mendez
left a comment
There was a problem hiding this comment.
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
marcos-mendez
left a comment
There was a problem hiding this comment.
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_modifiersCodecov risk
_get_brand_id_readonly_domain()returnsFalseby 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 involvingexpression.ORis 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:
- hr-attendance#262 [16.0][ADD] Hr_attendance_idsecure: iDSecure (ControliD) attendance integration
- stock-logistics-workflow#2276 [16.0][ADD] stock_move_line_devaluation
- stock-logistics-workflow#2275 [16.0][ADD] Stock move line analytic account
- stock-logistics-workflow#2268 [16.0][ADD] stock_move_line_picking_partner
- purchase-workflow#2694 [16.0][IMP]Purchase workflow added to review state & exception fix
Reviewing each other's work helps the whole community move forward faster. Thank you!
Automated review by OCA Neural Reviewer + qwen3-coder:30b
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.