Skip to content

Conversation

@anusriNPS
Copy link
Contributor

@anusriNPS anusriNPS commented Oct 8, 2025

Depends on base_geoengine PR #417
Domain for "attribute_field_id" is filtered based on "classification" field selection in vector layer, which helps to avoid JS error seen as "fsm.order" and "fsm.location" related fields are not validated based on "NUM_ATT" types. base_geoengine_validation.

Notifying user to define selected field from attribute_field_id of supported type in geoengine view which avoids below JS error observed:
Screenshot from 2025-10-08 17-09-18

Notifying users when a field of supported type from attribute_field_id is not suitable to use for classification type "custom" which avoids below observed JS Error:
image

As fieldservice_geoengine omits validation for custom classification related to "type" check on field selected in "attribute_field_id", when user selects fields of type "date" with "custom", below JS error observed:
image

@OCA-git-bot
Copy link
Contributor

Hi @wolfhall, @max3903,
some modules you are maintaining are being modified, check this out!

@anusriNPS anusriNPS changed the title [16.0][IMP] fieldservice_geoengie: Fix vector Layer related Errors [16.0][IMP] fieldservice_geoengie: Fix vector Layer related Error Oct 8, 2025
@anusriNPS anusriNPS changed the title [16.0][IMP] fieldservice_geoengie: Fix vector Layer related Error [16.0][IMP] fieldservice_geoengie: Fix vector Layer related Errors Oct 8, 2025
@anusriNPS anusriNPS marked this pull request as draft October 13, 2025 08:34
@anusriNPS
Copy link
Contributor Author

Notifying user to define selected field in geoengine view from attribute_field_id whose field is of supported type:
Screenshot from 2025-10-13 08-49-45

Notifying user when selected field in "attribute_field_id" is of supported type but not suitable for interval/custom range. Example: "color" field which is of "integer" type in "fsm.location" but could not generate interval/custom range, if not suppressed JS error is seen.

Interval range:
image
Custom range:
image

For custom classification with field type such as "date", based on this PR it suppress JS error but view displayed for "custom" will not be the expected view. This is because user needs to use proper field for selected field type to display customized view. Below is the view when "request_early" is selected from "attribute_field_id" for "custom".

image

@anusriNPS anusriNPS marked this pull request as ready for review October 14, 2025 06:45
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

Comment on lines +10 to +21
SUPPORTED_ATT = [
"float",
"integer",
"integer_big",
"related",
"function",
"date",
"datetime",
"char",
"text",
"selection",
]
Copy link
Contributor

Choose a reason for hiding this comment

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

chore (non-blocking): I see these elsewhere in the code as well, but I suspect they may have remained from previous versions, as I cannot find values of ttype matching some of these.

On a fresh odoo installation, opening a shell and inspecting env["ir.model.fields"]._fields["ttype"].selection I get the following fields

['binary', 'boolean', 'char', 'date', 'datetime', 'float', 'html', 'integer', 'json', 'many2many', 'many2one', 'many2one_reference', 'monetary', 'one2many', 'properties', 'properties_definition', 'reference', 'selection', 'text', 'serialized']

Copy link
Contributor Author

@anusriNPS anusriNPS Oct 22, 2025

Choose a reason for hiding this comment

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

env["ir.model.fields"]._fields["ttype"].selection - list all available ttype values.

fieldservice_geoengine supports only fields based on SUPPORTED_ATT and NUM_ATT which is used in domain to filter from ttype values.

ttype will not match the fields of supported_att and num_att variables and it should list all available types. ttype list seems right and this is my understanding. Please correct me, if my views differ from your thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I probably wasn't very clear. I didn't mean to imply that fields should be added to SUPPORTED_ATT, but rather that some may be removed (maybe?), like integer_big, related and function.

Either way, non-blocking.

Comment on lines 52 to 56
rec.geo_repr == "colored"
and (
rec.classification != "unique"
and rec.classification != "custom"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): readability

Suggested change
rec.geo_repr == "colored"
and (
rec.classification != "unique"
and rec.classification != "custom"
)
rec.geo_repr == "colored"
and rec.classification not in ("unique", "custom")

I would also add brackets for clarity

                    (rec.geo_repr == "colored"
                    and rec.classification not in ("unique", "custom"))
                    or ....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as suggested

   Notifying user to define selected attribute_field_id of
supported type from vector layer in infoBox template to avoid
JS error. Addressed JS Error when supported data type even
defined in geoengine view as well.
   When a field from attribute_field_id values selected from
vector layer is not suitable for "custom" classification, it
is notified to the user to avoid JS Error.Similarly for interval
classification is also taken care.
   Domain for attribute_field_id is filter based on classification
selection in vector layer to avoid JS Error.
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.

3 participants