The browser code editor
Every instance has a Code tab, for the Administrator and the Read-only administrator; the scoped roles do not see it. What it opens depends on who you are and where you are:
- The editor, writable: a full code editor in the browser. It does not edit a copy: it runs inside that instance's container, over the instance's own custom add-ons, with the container's terminal, IntelliSense for Python, and git.
- The read-only code: the same editor, read-only, beside the instance rather than inside it, with a sentence above it that says why it is read-only.
When the editor is writable
The editor opens writable for an Administrator, when all three of these hold:
- the server's edition includes the editor - the Developer edition, or Professional and up;
- the account has a developer workspace profile;
- the instance allows it: Allow editing in the browser editor on its Configuration tab, on by default for a development instance and off for every other. See Allow editing in the browser editor.
The read-only code
Wherever editing is not available, the Code tab shows the code read-only: the instance's custom add-ons and the Odoo source, with syntax coloring and search, and on an Enterprise instance the Enterprise add-ons too. There is no terminal, no git and no extensions. The sentence above it says what editing would need here - for example "Read-only: editing here needs a developer workspace profile on your account." When the edition is what is missing, it carries the edition badge and Compare the editions; when the instance's switch is off, a link to its Configuration tab. A Read-only administrator is told that editing is the Administrator's.
Every edition includes browsing the code, and so does a server without a license. Opening and closing the read-only code are recorded on the Jobs page with who opened it, and the read-only editor is stopped 30 minutes after the last browser leaves it.
What you get
| The files | The instance's custom add-ons, in place, in the running container |
| The terminal | The container's own shell, so python, pip and the Odoo shell are the instance's |
| Git | Your own credential and your own commit identity, not the server's |
| Panels | Full screen, or Open in a new browser tab for the editor full-window |
The editor is code-server, shipped as the ohm-code image beside the
management images. The agent puts it in place for the instance the first time you open it, so the
first open is slower than the rest - about a minute. The editor's files and each session's settings
and extensions are kept in a folder of the instance's own on the server that the instance's
container cannot write, so code running in the instance cannot change the editor you open.
To take that wait out of the first opening, prepare the editor ahead of time:
pelmo$ ohm instance code-editor prepare --instance fanesIt pulls the editor's image when the server lacks it and puts the editor in place for the instance, and answers at once when it is already there, so it is safe to run again.
Its own port: 5323
The Code tab opens the editor on a port of its own, 5323, on the same server name you reached the
console by, beside the console's 5322. It uses the console's certificate. A console reached on port
443 opens the editor on 5323 of the same server too. Port 5323 serves the editor and nothing else,
and the console's own ports no longer serve it. A console that has not been brought up to date says
"The browser editor has no address of its own on this console, so it cannot be opened": run
ohm install on the server. The editor does not forward the instance container's ports: an address
below the editor's own, such as /code/<instance>/proxy/8069/, answers 404. Reach a development
server another way, for example through the instance's own address or an SSH tunnel to the server.
Allow 5323 wherever you allow 5322: at your provider's firewall, in a security group, and in
antelao-ohm-ufw.sh, which opens it to your addresses from 0.24.0 on (see
Restricting the management ports). Through an SSH tunnel, forward both
ports:
ssh -N -L 5322:127.0.0.1:5322 -L 5323:127.0.0.1:5323 admin@pelmo.example.com
The console's sign-in does not carry over to 5323. Each time the Code tab opens an editor, it hands the editor's port a one-time pass for that one instance, and the editor never serves pages of your own making, so a page in one instance's editor cannot reach another instance's editor or the console.
Every open editor restarts once on its next open, and its SSH access and push credential work again with it. Every editor session also starts afresh once: the settings and the extensions a developer added in it are not carried over, and their workspace profile applies again.
It keeps running after you leave
Closing the tab does not stop the editor. It is stopped two hours after the last browser leaves, and the files you left are kept.
Two things end it immediately: stopping the instance, and applying a configuration change. Both recreate the container the editor is living in. The tab's Reopen button starts it again, with your files still there.
The license can end it too. When it stops carrying the browser editor, every open editor is stopped, its session and files kept, and nothing reopens it by itself: press Reopen once a license carries the editor again. See When the license changes.
Change your git credential or your commit identity and the editor already running still holds the old one. Press Reopen for it to pick the new one up.
Git is yours, not the server's
Pushing from the editor authenticates with your own credential for the host it talks to, taken from the Git tab of My Account. Add one there per git host; the editor's credential helper names the host it is asking for.
Commits carry your name and e-mail, from the Commit identity card on the same page. Without it, commits would be attributed to the console account, which is nobody in particular.
If you push without a credential for that host, the refusal says where to add one rather than failing with "write access not granted".
The editor does not borrow the GitHub connection on My Account, and a GitHub sign-in performed inside an editor is not used either. Add a git credential on the Git tab instead, and revoke any Visual Studio Code authorisation you granted from inside an editor.
Source control
The editor's Source Control view works, and so does git in its terminal: stage, commit, pull and push from either.
Updating a module from the instance's Modules tab moves the module's series branch - the branch
named after the instance's Odoo version, such as 18.0 - to the new commit.
It is refused while the editor holds uncommitted changes or unpushed commits for that module: commit
and push them, or discard them, then update again. See
Git-backed addons.
Fixing a live instance
An instance's Configuration tab offers the Code editor switch: turned on, after a confirmation, it opens the Code tab on a live instance, with its certificate, alerts, workers, scheduled actions and databases left exactly as they are. Turned off, it closes the editor again; that is refused while the editor holds work that is not committed and pushed.
A live instance with the code editor on has no debugger. Debugging belongs to a development instance, and attaching one to a live instance is not offered rather than being offered and discouraged.
Debugging
On a development instance, the editor's action panel carries start debugging, continue, pause and step, and the instance's Developer tab decides the mode: off, attach from the editor, or attach on start.
The panel also carries Start and Stop beside Restart, so the instance's Odoo can be stopped and started without leaving the editor, and Open the Odoo log in the command palette brings the log terminal up.
The editor opens on a stopped instance too, so you can fix what stopped it.
The floating panel
The Antelao panel floats over the editor. Drag its corner or its right edge to resize it, and right-click it or use its gear for the button chooser, which decides which controls it shows.
Delete this editor session stops the session and removes it, which is the button to use when an editor is behaving oddly rather than restarting the instance.
When the browser does not trust the server
The Code tab warns when the browser does not trust the server's certificate, because an editor loaded over an untrusted connection fails in ways that look like editor faults. The warning carries Reissue the console's certificate, which is usually the fastest way out of it on a server using its own certificate authority.
Known limits
- Firefox does not let the editor's terminal read the clipboard from its right-click menu. Paste with the keyboard instead.
- An instance whose image was built before git joined the image has no git in the editor's terminal. Rebuild the image from the Images page and it appears.