Description
current_parent_value() does not work in a Value Relation filter expression in the mobile app. The dropdown comes back empty.
Internal support ticket: https://support.lutraconsulting.co.uk/odoo/all-tickets/16951
Environment
Production
Application (+ app version, build, operating system)
Latest app, platform-independent
Steps to reproduce
- GeoPackage with three layers:
site (point) — site_id (text), habitat_code (text)
observation (table) — site_id (text), species_code (text), note (text)
species (table) — habitat_code (text), species_code (text), species_name (text), populated for at least two habitats
- 1:N relation
site.site_id (referenced) -> observation.site_id (referencing).
- On
site add a Relation widget for that relation to the drag-and-drop form.
- On
observation.species_code set widget Value Relation -> layer species, Key species_code, Value species_name, filter:
"habitat_code" = current_parent_value('habitat_code')
5a. Sync, open on mobile, create a site point, set habitat_code, create a linked observation row, save.
6a. Reopen the point and it's linked observation, hit edit record, try to open the species dropdown for the observation
5b. In plugin create a site point, set habitat_code, create a linked observation row, save.
6b. Reopen the point and its linked observation, hit edit record, choose a species. Sync.
7b. Open and sync the project on mobile. Open the point and its linked observation with the species chosen, hit edit record, and type something in the note field
Actual results
a, Dropdown is empty. Removing the filter shows all species.
b, Filled dropdown gets erased
Expected results
a, Dropdown lists only the species of the plant community selected on the parent feature, as it does in QGIS desktop.
b, When editing one field, the other should not change when it's not connected.
Extra debugging info
The app never builds a parent form scope for value-relation queries.
AttributeController itself does build the scope, which is why current_parent_value() works in virtual fields, default values, visibility and constraint expressions but not in the value-relation widget filter.
Parents do not work for these:
- Dropdown list query
- Display-text lookup
- Default values
AttributeController itself does build the scope (app/attributes/attributecontroller.cpp:886-889), which is why current_parent_value() works in virtual fields, default values, visibility and constraint expressions but not in the value-relation widget filter.
Description
current_parent_value() does not work in a Value Relation filter expression in the mobile app. The dropdown comes back empty.
Internal support ticket: https://support.lutraconsulting.co.uk/odoo/all-tickets/16951
Environment
Production
Application (+ app version, build, operating system)
Latest app, platform-independent
Steps to reproduce
site(point) —site_id(text),habitat_code(text)observation(table) —site_id(text),species_code(text),note(text)species(table) —habitat_code(text),species_code(text),species_name(text), populated for at least two habitatssite.site_id(referenced) ->observation.site_id(referencing).siteadd a Relation widget for that relation to the drag-and-drop form.observation.species_codeset widget Value Relation -> layerspecies, Keyspecies_code, Valuespecies_name, filter:"habitat_code" = current_parent_value('habitat_code')5a. Sync, open on mobile, create a
sitepoint, sethabitat_code, create a linkedobservationrow, save.6a. Reopen the point and it's linked observation, hit
edit record, try to open the species dropdown for the observation5b. In plugin create a
sitepoint, sethabitat_code, create a linkedobservationrow, save.6b. Reopen the point and its linked observation, hit
edit record, choose a species. Sync.7b. Open and sync the project on mobile. Open the point and its linked observation with the species chosen, hit
edit record, and type something in thenotefieldActual results
a, Dropdown is empty. Removing the filter shows all species.
b, Filled dropdown gets erased
Expected results
a, Dropdown lists only the species of the plant community selected on the parent feature, as it does in QGIS desktop.
b, When editing one field, the other should not change when it's not connected.
Extra debugging info
The app never builds a parent form scope for value-relation queries.
AttributeController itself does build the scope, which is why current_parent_value() works in virtual fields, default values, visibility and constraint expressions but not in the value-relation widget filter.
Parents do not work for these:
AttributeControlleritself does build the scope (app/attributes/attributecontroller.cpp:886-889), which is whycurrent_parent_value()works in virtual fields, default values, visibility and constraint expressions but not in the value-relation widget filter.