[16.0][ADD] helpesk_mgmt_stock_grn: links GRN to tickets#911
[16.0][ADD] helpesk_mgmt_stock_grn: links GRN to tickets#911nicolas-delbovier-acsone wants to merge 1 commit intoOCA:16.0from
Conversation
nicolas-delbovier-acsone
commented
Jan 5, 2026
b4735fd to
036189b
Compare
nihelgabsi-acsone
left a comment
There was a problem hiding this comment.
Functional test + code review
marcos-mendez
left a comment
There was a problem hiding this comment.
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.txtcorrectly references a stable branch or commit forhelpdesk-mgmt-stock. - Ensure that the
stock_grnmodule is properly installed and available in the test environment. - Validate that database connection settings are correctly configured for CI (e.g.,
runboator test runner).
3. Additional code issues
No real bugs found in the module code.
- The
grn_id,grn_date, anddelivery_note_supplier_numberfields are correctly defined asrelatedfields, which is the correct pattern for inheriting data from related models. - The view inheritance correctly extends the
helpdesk.ticketform 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:
- 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