Skip to content

[16.0][IMP] base_geoengine: Fix Vector Layer related Error#417

Open
anusriNPS wants to merge 1 commit intoOCA:16.0from
PyTech-SRL:16.0-fix-geoview
Open

[16.0][IMP] base_geoengine: Fix Vector Layer related Error#417
anusriNPS wants to merge 1 commit intoOCA:16.0from
PyTech-SRL:16.0-fix-geoview

Conversation

@anusriNPS
Copy link
Contributor

@anusriNPS anusriNPS commented Oct 8, 2025

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.

image

@anusriNPS
Copy link
Contributor Author

anusriNPS commented Oct 8, 2025

Notification displayed when supported type of attribute_field_id is not available as part of geoengine view definition:
Screenshot from 2025-10-08 16-52-26

@anusriNPS anusriNPS changed the title [16.0][IMP] base_geoengine: Fix Vector Layer related Errors [16.0][IMP] base_geoengine: Fix Vector Layer related Error Oct 8, 2025
Copy link
Contributor

@HekkiMelody HekkiMelody left a comment

Choose a reason for hiding this comment

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

Code review, LGTM

@github-actions
Copy link

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.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 22, 2026
@HekkiMelody
Copy link
Contributor

@OCA/geospatial-maintainers Could you please take a look? Thanks!

Copy link
Member

@yvaucher yvaucher left a comment

Choose a reason for hiding this comment

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

LGTM code review only

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 1, 2026
@legalsylvain
Copy link
Contributor

/ocabot merge patch

could you port your patch upstream ? thanks !

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-417-by-legalsylvain-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Mar 9, 2026
Signed-off-by legalsylvain
@OCA-git-bot
Copy link
Contributor

@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.
@anusriNPS
Copy link
Contributor Author

#442 Resolves pre-commit error seen due to recent changes in template

@HekkiMelody
Copy link
Contributor

/ocabot merge patch

could you port your patch upstream ? thanks !

Thank you for your time!

By "port upstream" you mean forward port to more recent versions of Odoo?

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 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: If cfg.attribute_field_id is undefined or null, the code will fail on cfg.attribute_field_id[1]. This should be guarded.
  • No handling of empty data in extractLayerValues: If data is empty, indicator_values will be an empty array, but some() will return false, 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:

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.

6 participants