[16.0][IMP] base_geoengine: Fix Vector Layer related Error#417
[16.0][IMP] base_geoengine: Fix Vector Layer related Error#417
Conversation
8b595bf to
6f142bd
Compare
6f142bd to
9825f67
Compare
9825f67 to
c1a88c7
Compare
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
|
@OCA/geospatial-maintainers Could you please take a look? Thanks! |
|
/ocabot merge patch could you port your patch upstream ? thanks ! |
|
What a great day to merge this nice PR. Let's do it! |
|
@legalsylvain your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-417-by-legalsylvain-bump-patch. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
Notifying user to define selected attribute_field_id of supported type from vector layer as part of geoengine view xml defintion which avoids observed JS error.
c1a88c7 to
c1f7b2e
Compare
|
#442 Resolves pre-commit error seen due to recent changes in template |
Thank you for your time! By "port upstream" you mean forward port to more recent versions of Odoo? |
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 directly related to the changes in geoengine_renderer.esm.js. This typically happens in CI environments (like Runboat) when the database is not ready or accessible, and not due to the code changes in this PR.
2. Suggested fix
No fix is needed for the current failure — it's an infrastructure issue. However, to ensure robustness in the JS code, the checkAttributeFieldUsage method should not assume cfg.attribute_field_id is always defined. Add a guard clause:
// In checkAttributeFieldUsage method, add:
if (!cfg.attribute_field_id) {
return true; // or handle gracefully
}3. Additional code issues
- Missing null check in
checkAttributeFieldUsage: Ifcfg.attribute_field_idis undefined or null, the code will fail oncfg.attribute_field_id[1]. This should be guarded. - No handling of empty data in
extractLayerValues: Ifdatais empty,indicator_valueswill be an empty array, butsome()will returnfalse, so no notification is shown — this is acceptable, but worth noting.
4. Test improvements
Add the following test cases to tests/test_geoengine_renderer.py or a new test file:
Test case: test_check_attribute_field_usage_with_missing_field
def test_check_attribute_field_usage_with_missing_field(self):
# Mock a vector config with no attribute_field_id
vector = {'attribute_field_id': False}
data = [{'_values': {}}]
with patch.object(self.renderer, 'extractLayerValues', return_value=[None]):
result = self.renderer.checkAttributeFieldUsage(vector, data)
self.assertFalse(result)Test case: test_check_attribute_field_usage_with_valid_field
def test_check_attribute_field_usage_with_valid_field(self):
vector = {'attribute_field_id': [1, 'test_field']}
data = [{'_values': {'test_field': 'value'}}]
with patch.object(self.renderer, 'extractLayerValues', return_value=['value']):
result = self.renderer.checkAttributeFieldUsage(vector, data)
self.assertTrue(result)Use TransactionCase or SavepointCase as per OCA patterns for testing JS logic that interacts with Odoo models. If testing UI behavior, consider HttpCase or BaseCase with mock for services like notification.
✅ These tests ensure the new guard logic in checkAttributeFieldUsage is properly covered and prevent runtime errors from malformed configs.
⏰ PR Aging Alert
This PR by @anusriNPS has been open for 158 days (5 months).
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

Notifying user to define selected attribute_field_id of supported type from vector layer as part of geoengine view xml defintion which avoids below observed JS error.