Skip to content

[16.0][IMP] mrp_sale_info: add optional attribute for the new fields in the…#1688

Open
MarinaAForgeFlow wants to merge 1 commit intoOCA:16.0from
ForgeFlow:16.0-imp-mrp_sale_info-add_workorder_view_optionals
Open

[16.0][IMP] mrp_sale_info: add optional attribute for the new fields in the…#1688
MarinaAForgeFlow wants to merge 1 commit intoOCA:16.0from
ForgeFlow:16.0-imp-mrp_sale_info-add_workorder_view_optionals

Conversation

@MarinaAForgeFlow
Copy link
Copy Markdown
Contributor

… workorder tree

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 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_info is 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_id and partner_id are visible by default, while commitment_date and client_order_ref are hidden unless manually shown.
  • Test field rendering in different contexts: Ensure the optional behavior works correctly in both list and form views if applicable.
  • Test with and without sale order linkage: Verify that fields like sale_id and partner_id are 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:

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants