[16.0][MIG] partner_country_lang: Migration to 16.0. - #2240
Conversation
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: partner-contact-13.0/partner-contact-13.0-partner_country_lang Translate-URL: https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_country_lang/
|
The commit name must be [MIG] partner_country_lang: Migration to 16.0 as this is a migration not an improvement. By other hand, the PR title must be [16.0] [MIG] partner_country_lang without spaces to find easier. |
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 startup, which prevents the test suite from running. This is not a code issue in the module itself but a test environment configuration problem.
2. Suggested Fix
The error occurs before any module code is executed, indicating an infrastructure or test setup issue. Ensure that:
- The database service (
postgres.runboat-infra.svc.cluster.local) is reachable. - The test database is correctly initialized.
- The
odoo.confor environment variables are properly configured for the test run.
This is not a code fix, but a test environment remediation.
3. Additional Code Issues
None found in the provided diffs. The code follows OCA patterns:
_adjust_lang_by_countryis a valid extension hook.@api.onchangeandcreate/writeoverrides are standard.- Use of
_lang_getis appropriate.
4. Test Improvements
Add tests covering:
_adjust_lang_by_countrybehavior increateandwrite._onchange_country_idlogic whencountry_idis changed.- Edge cases:
- Partner created without
country_idorlang. - Partner with
langalready set — should not be overridden. country_idchanged to one with no language defined.
- Partner created without
Suggested test pattern:
def test_create_partner_with_country_lang(self):
country = self.env['res.country'].create({'name': 'Test Country', 'lang': 'es_ES'})
partner = self.env['res.partner'].create({
'name': 'Test Partner',
'country_id': country.id,
})
self.assertEqual(partner.lang, 'es_ES')
def test_write_partner_country_lang(self):
country = self.env['res.country'].create({'name': 'Test Country', 'lang': 'es_ES'})
partner = self.env['res.partner'].create({
'name': 'Test Partner',
'country_id': False,
})
partner.write({'country_id': country.id})
self.assertEqual(partner.lang, 'es_ES')Use TransactionCase for tests involving database changes, as shown in the existing test file.
⏰ This PR has been open for 89 days.
💤 Last activity was 65 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
BhaveshHeliconia
left a comment
There was a problem hiding this comment.
Code and functional review LGTM!
|
@lfreeke Could you please change the title from [16.0][MIG] partner country lang to [16.0][MIG] partner_country_lang: Migration to 16.0. |
Done |
No description provided.