[16.0][IMP] mrp_sale_info: add optional attribute for the new fields in the…#1688
Conversation
marcos-mendez
left a comment
There was a problem hiding this comment.
Automated Review -- Tests Failed
1. Root Cause
The test failure is due to a database connection error (Connection to the database failed) during the Odoo server startup, not directly related to the XML view changes in mrp_workorder.xml. This suggests an infrastructure or environment issue in the test runner (likely Runbot), not a bug in the code itself.
2. Suggested Fix
No functional fix is needed for the code change. The modification to the optional attribute on fields (sale_id, partner_id, commitment_date, client_order_ref) in mrp_workorder.xml is valid and follows Odoo view conventions. However, ensure that:
- The module
mrp_sale_infois properly installed and all dependencies are met. - The test environment has correct database access and permissions.
3. Additional Code Issues
None found. The change is a view enhancement using standard Odoo optional field behavior (optional="show" / optional="hide"). It does not introduce any logic or functional bugs.
4. Test Improvements
To better test this change, consider adding or enhancing tests in a TransactionCase or SavepointCase:
Suggested Test Cases:
- Test visibility of fields in workorder view: Create a workorder and verify that
sale_idandpartner_idare visible by default, whilecommitment_dateandclient_order_refare hidden unless manually shown. - Test field rendering in different contexts: Ensure the
optionalbehavior works correctly in both list and form views if applicable. - Test with and without sale order linkage: Verify that fields like
sale_idandpartner_idare correctly populated when the workorder is linked to a sale order.
OCA Testing Pattern:
Use SavepointCase for tests involving view rendering and field visibility, as it isolates database changes and allows for more reliable testing of UI behavior.
Example test snippet:
def test_workorder_view_fields_visibility(self):
sale_order = self.env['sale.order'].create({...})
workorder = self.env['mrp.workorder'].create({
'name': 'Test Workorder',
'production_id': sale_order.production_ids[0].id,
})
view = self.env['ir.ui.view'].search([
('model', '=', 'mrp.workorder'),
('name', '=', 'mrp.workorder.form.inherit.sale.info')
])
self.assertTrue(view)This ensures that the optional field behavior is tested in a real Odoo environment.
⏰ This PR has been open for 66 days.
🔍 No human reviews yet after 66 days. PSC members: a quick review would help keep this contributor engaged with OCA.
💤 Last activity was 66 days ago.
Every ignored PR is a contributor who might not come back. Review time matters. (OCA Aging Report)
Reciprocal Review Request
Hi everyone! I found some test failures on this PR and left detailed feedback above. I am happy to discuss or help debug. In the meantime, if any of you get a chance, I would appreciate a look at my open PR(s):
My open PRs across OCA:
- server-tools#3554 [MIG] datetime_formatter: Migration to 18.0
- server-tools#3548 [18.0][MIG] base_kanban_stage: Migration to 18.0
- 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. Thank you!
Environment via OCA Neural Reviewer: Minikube + K8s Job + oca-ci/py3.10-odoo16.0 | Odoo 16.0
Automated review by OCA Neural Reviewer + qwen3-coder:30b
… workorder tree