Skip to content

[18.0][ADD] web_widget_mapbox: Mapbox map form widget - #478

Open
ivs-cetmix wants to merge 1 commit into
OCA:18.0from
cetmix:18.0-add-web_widget_mapbox
Open

[18.0][ADD] web_widget_mapbox: Mapbox map form widget#478
ivs-cetmix wants to merge 1 commit into
OCA:18.0from
cetmix:18.0-add-web_widget_mapbox

Conversation

@ivs-cetmix

@ivs-cetmix ivs-cetmix commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a Community form widget (widget="mapbox" on fields.Json) that renders markers from a JSON payload with Mapbox GL JS loaded from the CDN (v3.30.0), not vendored.
  • Store a dedicated Settings token (web_widget_mapbox.token / session mapbox_token) so this addon can sit next to Enterprise web_map without sharing map_box_token.
  • Support computed non-stored JSON for display, optional marker drag into updated, Map/Satellite styles, zoom/pan/pitch/ fullscreen flags, and a popup form when clickable + rec_model + rec_id are set.

Test plan

  • Install web_widget_mapbox on Community 18.0.
  • Set Settings → General Settings → Integrations → Mapbox Token to a public pk. token and save.
  • Put <field name="…" widget="mapbox"/> on a Json field and confirm the map renders; computed non-stored Json still displays.
  • Check camera uses default_center when valid, else the first pin; zoom/pan/pitch/fullscreen follow allow_*.
  • Drag an editable marker and confirm updated is upserted without rewriting elements.
  • Click a marker with clickable + rec_model + rec_id and confirm a form dialog opens (not the main action stack).
  • Confirm a portal session does not receive mapbox_token.

NB: this code was written using AI-assistance (Cursor), however was checked manually from A to Z. Yup, AI is a reality, just need to keep it under control 😄

Some screenshots from the real project running in prod.
image
image

Task 5602

@OCA-git-bot OCA-git-bot added series:18.0 mod:web_widget_mapbox Module web_widget_mapbox labels Sep 4, 2026
@ivs-cetmix
ivs-cetmix marked this pull request as draft September 4, 2026 14:00
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_mapbox branch 3 times, most recently from f7335d7 to adb3231 Compare September 4, 2026 15:20
Integrators needed a Community form widget that renders Mapbox from
a JSON payload without vendoring GL JS or sharing Enterprise
web_map's token field.

Task 5602

Co-authored-by: Cursor <cursoragent@cursor.com>
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_mapbox branch from ef4f59c to 7623d18 Compare September 7, 2026 17:45
@ivs-cetmix
ivs-cetmix marked this pull request as ready for review September 7, 2026 17:47
@ivs-cetmix

Copy link
Copy Markdown
Member Author

Hey @etobella @rvalyi @pedrobaeza I know this is not in the /web repo, yet it's a widget, so it might deserve your attention 😄

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Sep 8, 2026
@OCA-git-bot OCA-git-bot mentioned this pull request Sep 8, 2026
1 task
@pedrobaeza

Copy link
Copy Markdown
Member

If it doesn't depend on anything of geoengine as I see in the manifest, it should go to OCA/web.

@ivs-cetmix

ivs-cetmix commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

If it doesn't depend on anything of geoengine as I see in the manifest, it should go to OCA/web.

@pedrobaeza
Yes, I thought about it as well. However it's about maps and geo things, and this is the first repo where functional people would be looking for a module like this.
Same did I before pushing it.

@pedrobaeza

Copy link
Copy Markdown
Member

Can you include some kind of demo views to try the module?

@ivs-cetmix

Copy link
Copy Markdown
Member Author

Can you include some kind of demo views to try the module?

This will require to add some models as well. However I can do a tiny web_widget_mapbox_demo module, let me know this wokrs for you.

@pedrobaeza

pedrobaeza commented Sep 8, 2026

Copy link
Copy Markdown
Member

I was thinking in doing it in res.partner module, as it's in base one, and add menu/view in demo data as well. Isn't that enough, or do you need some fields? If not, a demo module may serve.

@ivs-cetmix

Copy link
Copy Markdown
Member Author

Yup, I thought about base and res.partner first as well, however we need some fields to store coordinates. Let me check what's would be the best solution here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_widget_mapbox Module web_widget_mapbox series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants