Skip to content

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

Open
ivs-cetmix wants to merge 2 commits 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 2 commits 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 4 times, most recently 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.

@OCA-git-bot OCA-git-bot added the mod:web_widget_mapbox_demo Module web_widget_mapbox_demo label Sep 8, 2026
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 a6d75e2 to 2c0eae1 Compare September 8, 2026 16:59
Give integrators a runnable partner-form example of the Mapbox
widget (draggable star, clickable child pins, Memmingen demo
data) without shipping that onto the widget addon itself.

Task 5602

Co-authored-by: Cursor <cursoragent@cursor.com>
@ivs-cetmix
ivs-cetmix force-pushed the 18.0-add-web_widget_mapbox branch from 2c0eae1 to 9c0a807 Compare September 8, 2026 17:23
@ivs-cetmix

Copy link
Copy Markdown
Member Author

A demo module is added, also I have created a token and added it to the runboat. You can test in on the Memes LLC partner.

@pedrobaeza pedrobaeza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested and working.

@Aldeigja Aldeigja left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Functional LGTM

@etobella

etobella commented Sep 9, 2026

Copy link
Copy Markdown
Member

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-478-by-etobella-bump-nobump, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

@etobella The merge process could not be finalized, because command twine upload --disable-progress-bar --non-interactive --repository-url https://upload.pypi.org/legacy/ -u __token__ odoo_addon_web_widget_mapbox-18.0.1.0.0.2-py3-none-any.whl failed with output:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading odoo_addon_web_widget_mapbox-18.0.1.0.0.2-py3-none-any.whl
�[33mWARNING �[0m Error during upload. Retry with the --verbose option for more details. 
�[31mERROR   �[0m HTTPError: 429 Too Many Requests from https://upload.pypi.org/legacy/  
         Too Many Requests                                                      

@ivs-cetmix

ivs-cetmix commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@etobella thank you! Looks like there is the same issue with pip as we had recently in the social repo.
P.S. Probably we need @sbidoul intervention again 😕

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@andreampiovesana andreampiovesana left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants