Skip to content

[16.0][ADD] helpesk_mgmt_stock_grn: links GRN to tickets#911

Open
nicolas-delbovier-acsone wants to merge 1 commit intoOCA:16.0from
acsone:16.0-add-helpdesk-mgmt-stock-grn-nde
Open

[16.0][ADD] helpesk_mgmt_stock_grn: links GRN to tickets#911
nicolas-delbovier-acsone wants to merge 1 commit intoOCA:16.0from
acsone:16.0-add-helpdesk-mgmt-stock-grn-nde

Conversation

@nicolas-delbovier-acsone
image

@nicolas-delbovier-acsone nicolas-delbovier-acsone force-pushed the 16.0-add-helpdesk-mgmt-stock-grn-nde branch from b4735fd to 036189b Compare January 7, 2026 07:24
@marcelsavegnago marcelsavegnago changed the title [ADD] helpesk_mgmt_stock_grn: links GRN to tickets [16.0][ADD] helpesk_mgmt_stock_grn: links GRN to tickets Jan 15, 2026
Copy link

@nihelgabsi-acsone nihelgabsi-acsone left a comment

Choose a reason for hiding this comment

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

Functional test + code review

Copy link

@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 of the test failure

The test failure is caused by a database connection error during the Odoo server startup, not due to the module code itself. The error indicates that the test environment could not connect to the PostgreSQL database (Connection to the database failed), likely due to misconfiguration or unavailability of the test database in the CI environment.


2. Suggested fix

There is no code fix required for the module itself. The failure is a setup/environment issue and not related to the logic in helpdesk_mgmt_stock_grn.

However, to ensure robustness in CI environments, the PR should:

  • Confirm that test-requirements.txt correctly references a stable branch or commit for helpdesk-mgmt-stock.
  • Ensure that the stock_grn module is properly installed and available in the test environment.
  • Validate that database connection settings are correctly configured for CI (e.g., runboat or test runner).

3. Additional code issues

No real bugs found in the module code.

  • The grn_id, grn_date, and delivery_note_supplier_number fields are correctly defined as related fields, which is the correct pattern for inheriting data from related models.
  • The view inheritance correctly extends the helpdesk.ticket form view.
  • The tests are well-structured and follow OCA patterns.

4. Test improvements

To improve test coverage and follow OCA patterns:

✅ Add a test for the case where stock_picking_id is not set

def test_grn_fields_without_picking(self):
    """Test that fields are empty when no picking is set."""
    ticket = self.env["helpdesk.ticket"].create(
        {
            "name": "Test Ticket",
            "description": "Test description",
        }
    )
    self.assertFalse(ticket.grn_id)
    self.assertFalse(ticket.grn_date)
    self.assertFalse(ticket.delivery_note_supplier_number)

✅ Add a test for grn_id being False when stock_picking_id.grn_id is False

def test_grn_fields_with_no_grn(self):
    """Test that fields are empty when no GRN is linked to the picking."""
    picking = self.env["stock.picking"].create(
        {
            "picking_type_id": self.env.ref("stock.picking_type_in").id,
            "location_id": self.env.ref("stock.stock_location_suppliers").id,
            "location_dest_id": self.env.ref("stock.stock_location_stock").id,
        }
    )
    ticket = self.env["helpdesk.ticket"].create(
        {
            "name": "Test Ticket",
            "stock_picking_id": picking.id,
            "description": "Test description",
        }
    )
    self.assertFalse(ticket.grn_id)
    self.assertFalse(ticket.grn_date)
    self.assertFalse(ticket.delivery_note_supplier_number)

✅ Use SavepointCase for more complex test scenarios (optional but recommended for data isolation)

If more complex scenarios (e.g., multi-ticket, multi-picking) are to be tested, consider inheriting from SavepointCase instead of TransactionCase.


Summary

  • The test failure is not due to the module code, but due to a database connection issue in the test environment.
  • The module is correctly implemented with related fields and inheritance.
  • Suggested improvements include adding edge-case tests for missing picking or GRN data.
  • No bugs found in current implementation.

⏰ This PR has been open for 69 days.
💤 Last activity was 58 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.

4 participants