Support ticket: https://odoo.lutraconsulting.co.uk/odoo/all-tickets/16929
What
In Photo attachments configuration in Project Properties, custom photo name expressions on fields with whitespace are lost after closing and reopening QGIS. Mobile fails to rename the photos.
Why
Expressions are stored as QGIS project properties under a key built from the field name:
PhotoNaming/<layer_id>/<field_name>
When QGIS writes the project, it strips characters that aren't valid in an XML element name - spaces, leading digits, punctuation. So a field named Photo before is saved as the tag <Photobefore>, but on reload the plugin looks it up by the original name Photo before, which no longer matches.
Affected: fields whose names contain spaces, start with a digit, or contain punctuation. Accented characters (ø, æ, ç) are fine.
Reproduce
- Add an attachment field whose name contains a space (e.g. pho to).
- Set a photo naming expression, apply, save the project.
- Close and reopen QGIS, reopen the project → the expression is gone.
The expression works within the session (the preview is correct), but reloading the project shows it blank.
Fix: stop embedding the names as key tokens (store the mapping as a value, e.g. JSON) - the field/layer names then round-trip safely.
Note: the Mergin mobile app reads this property too, so the storage-format change needs a matching update on the mobile side.
Support ticket: https://odoo.lutraconsulting.co.uk/odoo/all-tickets/16929
What
In Photo attachments configuration in Project Properties, custom photo name expressions on fields with whitespace are lost after closing and reopening QGIS. Mobile fails to rename the photos.
Why
Expressions are stored as QGIS project properties under a key built from the field name:
PhotoNaming/<layer_id>/<field_name>
When QGIS writes the project, it strips characters that aren't valid in an XML element name - spaces, leading digits, punctuation. So a field named
Photo beforeis saved as the tag<Photobefore>, but on reload the plugin looks it up by the original namePhoto before, which no longer matches.Affected: fields whose names contain spaces, start with a digit, or contain punctuation. Accented characters (ø, æ, ç) are fine.
Reproduce
The expression works within the session (the preview is correct), but reloading the project shows it blank.
Fix: stop embedding the names as key tokens (store the mapping as a value, e.g. JSON) - the field/layer names then round-trip safely.
Note: the Mergin mobile app reads this property too, so the storage-format change needs a matching update on the mobile side.