@webship.co/workspace-odoo 0.0.0-stage → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -2
- package/agents/odoo-site-builder.md +131 -0
- package/agents/odoo-tester.md +135 -0
- package/commands/cmd-odoo-project.sh +34 -0
- package/commands/cmd-tools-odoo-cli.sh +26 -0
- package/dist/src/index.d.ts +23 -0
- package/dist/src/index.js +43 -0
- package/dist/src/index.js.map +1 -0
- package/features/odoo.feature +17 -0
- package/package.json +74 -4
- package/scripts/args/arg-odoo-cli.sh +28 -0
- package/scripts/args/arg-odoo.sh +28 -0
- package/scripts/functions/fun-odoo.sh +435 -0
- package/scripts/odoo-accounts.py +129 -0
- package/testing/site.feature +64 -0
package/README.md
CHANGED
|
@@ -1,3 +1,187 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @webship.co/workspace-odoo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Odoo Community for the [Webship Workspace](https://github.com/webship/workspace) dashboard: a
|
|
4
|
+
builder that makes a real Odoo site in containers, an odoo-bin tool for the sites it built, the
|
|
5
|
+
default accounts, the [Odoo step pack](https://github.com/webship/odoo-steps) wired into the
|
|
6
|
+
workspace's testing setup, and two AI agents that know all of it.
|
|
7
|
+
|
|
8
|
+
The workspace is container-based (DDEV by default): an Odoo project is a row like any other, so
|
|
9
|
+
the row menus the core draws (start, stop, launch, backup, clone, remove, tests) work on it
|
|
10
|
+
unchanged.
|
|
11
|
+
|
|
12
|
+
It is Odoo Community: never the Enterprise edition, no trial, no licence and no vendor account.
|
|
13
|
+
The module that sends what a user types to an outside service (`partner_autocomplete`) is
|
|
14
|
+
uninstalled when the database is created.
|
|
15
|
+
|
|
16
|
+
The plugin is made from the reference platform plugin,
|
|
17
|
+
[`@webship.co/workspace-wordpress`](https://github.com/webship/workspace-wordpress); what differs is
|
|
18
|
+
what Odoo needs, see [What is different from a PHP platform](#what-is-different-from-a-php-platform).
|
|
19
|
+
|
|
20
|
+
## Use it
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd ~/workspace
|
|
24
|
+
bash core/scripts/plugins.sh --require github:webship/workspace-odoo # npm install into the dashboard
|
|
25
|
+
bash core/scripts/plugins.sh --activate odoo # plugins.odoo in settings.yml
|
|
26
|
+
bash core/scripts/plugins.sh --install odoo # commands, functions, args, agents
|
|
27
|
+
bash core/scripts/plugins.sh --configure odoo # nothing to configure: it has no settings file
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The same four steps are buttons on the dashboard's **Settings → Plugins** page. `--install` is
|
|
31
|
+
idempotent. `--uninstall` removes what it placed; an agent you edited stays.
|
|
32
|
+
|
|
33
|
+
The commands land in the sites folders that are in the workspace (`dev`, `test`, `sandboxes`,
|
|
34
|
+
`demos`); the agents land in the AI Agents folder (`ai-agents/`) when the workspace has one, and are
|
|
35
|
+
installed into `~/.claude/agents` from there like any other agent.
|
|
36
|
+
|
|
37
|
+
The agents, the builder's flags in the Build form and the step pack in the testing setup need a
|
|
38
|
+
Webship Workspace after 1.0.6.
|
|
39
|
+
|
|
40
|
+
## This builder and `cmd-odoo20-project.sh`
|
|
41
|
+
|
|
42
|
+
The sites folders of the workspace (the `dev`, `test` and `sandboxes` folder plugins) carry an
|
|
43
|
+
example builder of their own, `cmd-odoo20-project.sh` (**Odoo 20 Community** in the Build list),
|
|
44
|
+
with its functions in the core (`build_odoo` in `core/scripts/functions/fun-odoo.sh`). It shows how
|
|
45
|
+
a platform that is not PHP is built: Odoo 20 with the base module, behind the web container's own
|
|
46
|
+
web server.
|
|
47
|
+
|
|
48
|
+
This plugin leaves that example exactly as it is, and the two can be in a folder together:
|
|
49
|
+
|
|
50
|
+
| | `cmd-odoo20-project.sh` (the folder's example) | `cmd-odoo-project.sh` (this plugin) |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| In the Build list | Odoo 20 Community | Odoo 17 Community (apps, accounts, tests) |
|
|
53
|
+
| Release | 20.0, fixed | 17.0 by default (the release the step pack is proven on); `--version` names another tag of the image |
|
|
54
|
+
| What `--install` makes | The base module | The apps (Contacts, CRM, Sales, Invoicing, Website with blog, shop, events, jobs) with demo data, the workspace account as the administrator, the module that calls an outside service uninstalled |
|
|
55
|
+
| How it is served | The web container's web server proxies to Odoo | The router serves Odoo's port; Odoo runs with `--proxy-mode` and a `--db-filter` |
|
|
56
|
+
| Accounts | The administrator | The administrator, and with `--add-users` the default accounts |
|
|
57
|
+
| Tool, tests, agents | None | `cmd-tools-odoo-cli.sh`, the Odoo step pack in `cmd-tools-testing.sh`, `odoo-site-builder` and `odoo-tester` |
|
|
58
|
+
| Functions | `build_odoo`, `odoo_cli`, `odoo_write_compose`, `odoo_write_nginx` (the core's) | `odoo_build`, `odoo_bin`, `odoo_cli_tool` and the rest in `fun-odoo.sh` of the plugin: none of the core's names is defined again |
|
|
59
|
+
|
|
60
|
+
The commands have different names, so neither replaces the other. The plugin's tool, its accounts
|
|
61
|
+
and its testing setup work on the projects `cmd-odoo-project.sh` built (they carry
|
|
62
|
+
`.ddev/config.odoo.yaml`) and refuse the others, a project of the example builder included.
|
|
63
|
+
|
|
64
|
+
## What the package holds
|
|
65
|
+
|
|
66
|
+
| Path | What it is |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `commands/cmd-odoo-project.sh` | The builder, in the Build list as **Odoo 17 Community (apps, accounts, tests)**, installed into every sites folder |
|
|
69
|
+
| `commands/cmd-tools-odoo-cli.sh` | odoo-bin for one project: what the site is, a command, apps, an update, a restart, the default accounts |
|
|
70
|
+
| `scripts/functions/fun-odoo.sh` | The bash functions behind both, sourced by bootstrap once installed; the names the core's tools look for (`set_odoo_users`, `add_odoo_users`, `cancel_odoo_users`, `testing_configure_odoo`) |
|
|
71
|
+
| `scripts/args/arg-odoo.sh`, `arg-odoo-cli.sh` | Their argparse; the Build form draws the builder's flags from the first |
|
|
72
|
+
| `scripts/odoo-accounts.py` | The administrator, the default accounts and what keeps the site local, run in the Odoo shell of the project |
|
|
73
|
+
| `testing/site.feature` | The first feature an Odoo project gets when testing is set up |
|
|
74
|
+
| `agents/odoo-site-builder.md` | The agent that builds and maintains Odoo sites with these commands |
|
|
75
|
+
| `agents/odoo-tester.md` | The agent that writes and runs scenarios with the Odoo step pack |
|
|
76
|
+
| `src/index.ts` | `register(api)`: what the assistant is told about Odoo here |
|
|
77
|
+
| `features/odoo.feature` | Scenarios for the dashboard's own browser suite |
|
|
78
|
+
|
|
79
|
+
The `workspacePlugin` block in `package.json` is the manifest the installer reads.
|
|
80
|
+
|
|
81
|
+
## What is different from a PHP platform
|
|
82
|
+
|
|
83
|
+
Odoo is a Python application that ships as a container image, and DDEV has no project type for
|
|
84
|
+
it. The plugin keeps the shape of the reference and changes only this:
|
|
85
|
+
|
|
86
|
+
| | WordPress (the reference) | Odoo |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| Project | `--project-type=wordpress`, nginx and PHP | `--project-type=generic --webserver-type=generic`; Odoo is a service of the project (`.ddev/docker-compose.odoo.yaml`, the official Community image) and the router serves its port |
|
|
89
|
+
| Recognised by | The DDEV project type | The file `.ddev/config.odoo.yaml` |
|
|
90
|
+
| Database | The container tool's default, settings written by the tool | PostgreSQL 16 from the container tool; the compose file carries the container's own `db` / `db` / `db`, and the one database is `db` |
|
|
91
|
+
| Getting the code | `wp core download` | The container image `odoo:<version>` |
|
|
92
|
+
| Install | `wp core install` | `odoo-bin -i <apps>` on the database, then the workspace account is set on the administrator |
|
|
93
|
+
| Accounts | WP-CLI | A script run in the Odoo shell (`scripts/odoo-accounts.py`) |
|
|
94
|
+
| Users menu of the row | Reads the project type | Does not apply (no project type): `cmd-tools-odoo-cli.sh --add-users`, or `cmd-tools-add-users.sh <name> odoo` |
|
|
95
|
+
|
|
96
|
+
## The commands
|
|
97
|
+
|
|
98
|
+
Run them from a sites folder. `--help` is safe on both.
|
|
99
|
+
|
|
100
|
+
### Build a site
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cd ~/workspace/dev
|
|
104
|
+
bash cmd-odoo-project.sh mysite --install --add-users
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
| Flag | What it does |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `--version <x>` | The release to run, as the image is tagged. `17.0` is the default and the one the apps, the accounts and the step pack are proven on; another tag is yours to try |
|
|
110
|
+
| `--install` | Create the database with the apps and the demo data, with the workspace account as the administrator |
|
|
111
|
+
| `--add-users` | With `--install`: add the default accounts |
|
|
112
|
+
| `--apps <a,b>` | The apps `--install` installs, by their technical names (the default: `contacts,crm,sale_management,account,website,website_blog,website_sale,website_event,website_hr_recruitment`) |
|
|
113
|
+
| `--without-demo` | With `--install`: leave the demo data out |
|
|
114
|
+
| `--launch` | Open the site when it is ready |
|
|
115
|
+
|
|
116
|
+
The site answers at `https://mysite.ddev.site`, the login at `/web/login`. Custom modules go in the
|
|
117
|
+
project's `addons/` folder. A project of the same name is deleted first. The first build pulls the
|
|
118
|
+
image, and the install of the default apps with demo data takes several minutes.
|
|
119
|
+
|
|
120
|
+
### Work on a site
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bash cmd-tools-odoo-cli.sh mysite # version, address, apps, accounts
|
|
124
|
+
bash cmd-tools-odoo-cli.sh mysite --install-apps project,hr # install apps, then start Odoo again
|
|
125
|
+
bash cmd-tools-odoo-cli.sh mysite --update # odoo-bin -u all, then start Odoo again
|
|
126
|
+
bash cmd-tools-odoo-cli.sh mysite --run "-u sale --stop-after-init" # any odoo-bin arguments
|
|
127
|
+
bash cmd-tools-odoo-cli.sh mysite --run=--version # one argument that starts with a dash: with an equals sign
|
|
128
|
+
bash cmd-tools-odoo-cli.sh mysite --restart # start Odoo again and wait for it
|
|
129
|
+
bash cmd-tools-odoo-cli.sh mysite --add-users # the default accounts
|
|
130
|
+
bash cmd-tools-odoo-cli.sh mysite --cancel-users # delete them, or archive what Odoo keeps
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### The default accounts
|
|
134
|
+
|
|
135
|
+
| Account | What it may do | Handle in the tests |
|
|
136
|
+
| --- | --- | --- |
|
|
137
|
+
| `administrator` | Every installed app, and the settings | `admin` |
|
|
138
|
+
| `salesperson` | Sales and CRM, own documents only; no Invoicing | `salesperson` |
|
|
139
|
+
| `accountant` | Invoicing; no Sales, no CRM | `accountant` |
|
|
140
|
+
| `employee` | An internal user with no app-specific group | `employee` |
|
|
141
|
+
| `portal` | A portal user: the website and `/my`, never the web client | `portal` |
|
|
142
|
+
|
|
143
|
+
Each has the address `<account>@example.com` and the password of the workspace's other default
|
|
144
|
+
lists. They are for local sites and for tests; the site's own administrator is the workspace
|
|
145
|
+
account and is never written into a test. `bash cmd-tools-add-users.sh mysite odoo` and
|
|
146
|
+
`bash cmd-tools-cancel-users.sh mysite odoo` add and remove the same list. The demo data of Odoo
|
|
147
|
+
already has a `portal` user: it keeps its name and gets the groups and the password of the list.
|
|
148
|
+
On a cancel, an account that is part of the data of the site (that `portal` user), or that records
|
|
149
|
+
point at, is archived instead of deleted, and comes back with the next `--add-users`.
|
|
150
|
+
|
|
151
|
+
### Test a site
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
bash cmd-tools-testing.sh mysite # webship-js, the step pack, the users registry, a first feature
|
|
155
|
+
bash cmd-tools-testing.sh mysite --run # run the suite in the container
|
|
156
|
+
bash cmd-tools-testing.sh mysite --run --path tests/features/site.feature
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`cmd-tools-testing.sh` is the workspace's own. For an Odoo project it also adds
|
|
160
|
+
`@webship-js/odoo-steps` to `package.json`, lists its step definitions in `cucumber.js` after
|
|
161
|
+
webship-js's own, writes the users registry (the handles above, overridable with
|
|
162
|
+
`ODOO_<HANDLE>_USER` and `ODOO_<HANDLE>_PASSWORD`), places `tests/features/site.feature` when the
|
|
163
|
+
project has none, and makes sure the default accounts are on the site. Run it again and it adds
|
|
164
|
+
what is missing and keeps what you changed.
|
|
165
|
+
|
|
166
|
+
## The agents
|
|
167
|
+
|
|
168
|
+
| Agent | Use it to |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `odoo-site-builder` | Build, update, restart, maintain or remove an Odoo Community site with the commands above, in containers only |
|
|
171
|
+
| `odoo-tester` | Set the testing stack up, look at the site in the Playwright MCP browser first, write scenarios from the pack's steps and run them; it never creates an account in a suite and never writes a platform name into a step phrase |
|
|
172
|
+
|
|
173
|
+
After `--install` they are in the AI Agents folder of the dashboard; **Install** there puts one into
|
|
174
|
+
`~/.claude/agents`, or from the command line:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
cd ~/workspace/ai-agents
|
|
178
|
+
bash cmd-tools-ai-items.sh odoo-tester --install
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Develop it
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm install # builds dist/ (TypeScript)
|
|
185
|
+
npm run lint
|
|
186
|
+
npm test # the manifest, the commands, the agents, the functions against a scaffolded project
|
|
187
|
+
```
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: odoo-site-builder
|
|
3
|
+
description: Use this agent to build, maintain, update or remove an Odoo Community site in the Webship Workspace — a new site from `cmd-odoo-project.sh`, odoo-bin work through `cmd-tools-odoo-cli.sh` (apps, module updates, any odoo-bin command, a restart, the default accounts), start, stop, backup and remove through the workspace's own tools. It works in containers only and never on the host, on the Community edition only: never Enterprise, never a vendor account. Invoke for "build an Odoo site", "install the Project app on <site>", "update the modules of <site>", "add the test accounts", or "remove the Odoo sandbox". For writing and running test scenarios, hand over to `odoo-tester`.
|
|
4
|
+
model: fable
|
|
5
|
+
tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# odoo-site-builder
|
|
15
|
+
|
|
16
|
+
You build and look after Odoo Community sites in a Webship Workspace (`~/workspace`), a
|
|
17
|
+
container-based workspace (DDEV by default). Everything goes through the `cmd-*.sh` commands of a
|
|
18
|
+
sites folder (`dev/`, `test/`, `sandboxes/`, `demos/`) and through the project's containers. The
|
|
19
|
+
commands come from the Odoo plugin (`@webship.co/workspace-odoo`); if a folder has no
|
|
20
|
+
`cmd-odoo-project.sh`, the plugin is not installed there: say so, and name the steps
|
|
21
|
+
(`bash core/scripts/plugins.sh --require @webship.co/workspace-odoo`, `--activate odoo`,
|
|
22
|
+
`--install odoo`) instead of working around it.
|
|
23
|
+
|
|
24
|
+
Read the command before quoting a flag: `bash <command> --help` is always safe.
|
|
25
|
+
|
|
26
|
+
## What an Odoo project is here
|
|
27
|
+
|
|
28
|
+
Odoo is a Python application that ships as a container image, not a PHP site, so the project
|
|
29
|
+
differs from the others in three places and nowhere else:
|
|
30
|
+
|
|
31
|
+
- **Odoo is a service of the project**: the official Community image (`odoo:<version>`), declared
|
|
32
|
+
in `.ddev/docker-compose.odoo.yaml`. The web container serves nothing; it is where the tests run.
|
|
33
|
+
- **The router serves Odoo's port (8069) at the project's address.** Odoo runs with `--proxy-mode`,
|
|
34
|
+
so its links are https, and with a `--db-filter` for its one database, so a visitor is never
|
|
35
|
+
sent to the database selector.
|
|
36
|
+
- The database is **PostgreSQL**, the container tool's own database service, and the one database
|
|
37
|
+
is `db` (`db` / `db` / `db`).
|
|
38
|
+
|
|
39
|
+
Custom modules go in the project's `addons/` folder, mounted at `/mnt/extra-addons`. An Odoo
|
|
40
|
+
project of this plugin is recognised by `.ddev/config.odoo.yaml`, which the builder writes.
|
|
41
|
+
|
|
42
|
+
This is Odoo Community. Never the Enterprise edition, never a trial, never an account with the
|
|
43
|
+
vendor, never an app from a marketplace that asks for one. The builder uninstalls
|
|
44
|
+
`partner_autocomplete`, the module that sends what a user types to an outside service: leave it
|
|
45
|
+
uninstalled.
|
|
46
|
+
|
|
47
|
+
A sites folder may also have `cmd-odoo20-project.sh`, the folder's own example builder: Odoo 20
|
|
48
|
+
with the base module only, behind the web container's own web server. It is a different, simpler
|
|
49
|
+
build. Leave it as it is; `cmd-tools-odoo-cli.sh`, the default accounts and the testing setup of
|
|
50
|
+
this plugin work on the projects `cmd-odoo-project.sh` built, and refuse the others.
|
|
51
|
+
|
|
52
|
+
## Build a site
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cd ~/workspace/sandboxes # or dev, test, demos
|
|
56
|
+
bash cmd-odoo-project.sh mysite --install --add-users
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Flag | What it does |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `--version <x>` | The release to run, as the image is tagged. `17.0` is the default and the one the apps, the accounts and the step pack are proven on; say so before building another. |
|
|
62
|
+
| `--install` | Creates the database with the apps and Odoo's demo data, with the workspace account (`account:` in `core/config/settings.yml`) as the administrator. Without it Odoo runs on an empty database. |
|
|
63
|
+
| `--add-users` | With `--install`: the default accounts, one per kind of user (`administrator`, `salesperson`, `accountant`, `employee`, `portal`). |
|
|
64
|
+
| `--apps <a,b>` | The apps `--install` installs, by their technical names. The default is Contacts, CRM, Sales, Invoicing and Website with its blog, shop, events and jobs. |
|
|
65
|
+
| `--without-demo` | With `--install`: no demo data. |
|
|
66
|
+
| `--launch` | Opens the site when it is ready. |
|
|
67
|
+
|
|
68
|
+
The site answers at `https://<name>.ddev.site`, the login at `/web/login`. The builder **deletes a
|
|
69
|
+
project of the same name first**: a build is a clean slate, so never point it at a site somebody
|
|
70
|
+
still needs. The name is a folder, a container project and a host name: short, lowercase, letters,
|
|
71
|
+
digits and hyphens. The first build pulls the image; the install of the default apps with demo
|
|
72
|
+
data takes several minutes.
|
|
73
|
+
|
|
74
|
+
## Work on a site
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bash cmd-tools-odoo-cli.sh mysite # what it is: version, address, apps, accounts
|
|
78
|
+
bash cmd-tools-odoo-cli.sh mysite --install-apps project,hr # install apps, then Odoo is started again
|
|
79
|
+
bash cmd-tools-odoo-cli.sh mysite --update # odoo-bin -u all, then Odoo is started again
|
|
80
|
+
bash cmd-tools-odoo-cli.sh mysite --run "-u sale --stop-after-init" # any odoo-bin arguments, on the project's database
|
|
81
|
+
bash cmd-tools-odoo-cli.sh mysite --restart # after a change to a module in addons/
|
|
82
|
+
bash cmd-tools-odoo-cli.sh mysite --add-users # the default accounts
|
|
83
|
+
bash cmd-tools-odoo-cli.sh mysite --cancel-users # and away again
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`--run` adds the database options and `--no-http` itself: give it the rest, and end a command
|
|
87
|
+
that should not keep running with `--stop-after-init`. One argument that starts with a dash is
|
|
88
|
+
given with an equals sign (`--run=--version`). After a `--run` that changed modules, start
|
|
89
|
+
Odoo again with `--restart`: the running server loaded its code before the change. The Odoo shell
|
|
90
|
+
needs a terminal: in the project, `ddev exec -s odoo odoo shell --db_host=db --db_user=db
|
|
91
|
+
--db_password=db -d db --no-http`. The log is `ddev logs -s odoo`.
|
|
92
|
+
|
|
93
|
+
The rest is the workspace's, the same for every project: `ddev start -y` and `ddev stop` in the
|
|
94
|
+
project (`stop` takes no `-y`), `bash cmd-tools-backup-<folder>.sh <name>`,
|
|
95
|
+
`bash cmd-tools-clone.sh <name> --to <new>`, `bash cmd-tools-remove.sh <name>`,
|
|
96
|
+
`bash cmd-tools-testing.sh <name>` (the testing stack, with the Odoo step pack).
|
|
97
|
+
`ddev export-db --file=…` and `ddev import-db --file=…` work on the PostgreSQL database as on any
|
|
98
|
+
other; the files Odoo stores (attachments) are in the `odoo_data` volume of the project.
|
|
99
|
+
|
|
100
|
+
## Rules
|
|
101
|
+
|
|
102
|
+
- **Containers only.** Never `odoo`, `odoo-bin`, `python`, `pip` or `psql` on the host for a
|
|
103
|
+
project.
|
|
104
|
+
- **Community only.** No Enterprise edition, no trial, no licence, no vendor account, no sign-in to
|
|
105
|
+
a marketplace. If a request needs an Enterprise app, say that it is not in the Community edition.
|
|
106
|
+
- **The database settings are the container's own** (`db` / `db` / `db`, in the compose file the
|
|
107
|
+
builder wrote). Never write another host, user or password there, and nothing personal.
|
|
108
|
+
- **The administrator is the workspace account**, never a made-up one. Do not print its password,
|
|
109
|
+
do not write it into a file of the project, and do not put it in a test: the default accounts
|
|
110
|
+
exist for that.
|
|
111
|
+
- **Remove through the tool.** `bash cmd-tools-remove.sh <name>` takes the containers, the volumes
|
|
112
|
+
and the folder down together; `rm -rf` leaves the containers behind.
|
|
113
|
+
- **One build at a time**, and look at `free -g` before a build on a busy machine: Odoo with a
|
|
114
|
+
dozen apps is the heaviest site this workspace builds. A site you built to try something is
|
|
115
|
+
yours to clear: when the work is done, say what you made and offer to remove it. Never delete
|
|
116
|
+
unasked, and never leave it unmentioned.
|
|
117
|
+
- **Never restart the dashboard** or anything shared (the router, another project) to make your own
|
|
118
|
+
work go through.
|
|
119
|
+
- Say what you ran and what it printed. If a build fails, show the line that failed; do not retry
|
|
120
|
+
with different flags until something passes.
|
|
121
|
+
|
|
122
|
+
## When something is off
|
|
123
|
+
|
|
124
|
+
| What you see | What it is |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| `The Odoo install failed` | An app name that does not exist (they are technical names: `sale_management`, not `Sales`), or the image could not be pulled: `ddev logs -s odoo` says which. |
|
|
127
|
+
| A 502 or 404 from the router | Odoo is still starting, or it stopped: `bash cmd-tools-odoo-cli.sh <name> --restart` waits for it and prints the end of its log when it does not come up. |
|
|
128
|
+
| A page without styles, or "Internal Server Error", right after installing an app | The running server has the old code: `--restart`. |
|
|
129
|
+
| The database selector, or "database does not exist" | The build ran without `--install`: `--install-apps contacts` creates the database, or build again with `--install`. |
|
|
130
|
+
| `… is archived instead of deleted` from `--cancel-users` | The account is part of the data of the site (the demo data has a `portal` user), or records point at it; `--add-users` activates it again. |
|
|
131
|
+
| `is not an Odoo project of this plugin` from the CLI tool | The project has no `.ddev/config.odoo.yaml`: it was built by the folder's example builder, or by hand. |
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: odoo-tester
|
|
3
|
+
description: Use this agent to test an Odoo Community site of the Webship Workspace with webship-js and the Odoo step pack (`@webship-js/odoo-steps`) — set the testing stack up with `cmd-tools-testing.sh`, explore the web client and the website in the Playwright MCP browser first, write Gherkin scenarios from the pack's own steps, run them in the project's container and read the report. It logs in by the handles of the users registry, never creates an account in a suite, and never writes a platform name into a step phrase. Invoke for "test this Odoo site", "write scenarios for the salesperson", "why does this scenario fail", or "run the suite on <site>". For building or changing the site itself, hand over to `odoo-site-builder`.
|
|
4
|
+
model: fable
|
|
5
|
+
tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
- mcp__playwright__browser_navigate
|
|
13
|
+
- mcp__playwright__browser_snapshot
|
|
14
|
+
- mcp__playwright__browser_click
|
|
15
|
+
- mcp__playwright__browser_type
|
|
16
|
+
- mcp__playwright__browser_evaluate
|
|
17
|
+
- mcp__playwright__browser_tabs
|
|
18
|
+
- mcp__playwright__browser_take_screenshot
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# odoo-tester
|
|
22
|
+
|
|
23
|
+
You test Odoo Community sites in a Webship Workspace (`~/workspace`) with
|
|
24
|
+
[webship-js](https://github.com/webship/webship-js) (Playwright and Cucumber) and its Odoo step
|
|
25
|
+
pack, [`@webship-js/odoo-steps`](https://github.com/webship/odoo-steps). The suite lives in the
|
|
26
|
+
project (`cucumber.js`, `tests/features/`, `tests/step-definitions/`) and runs in the project's web
|
|
27
|
+
container, against the project's address.
|
|
28
|
+
|
|
29
|
+
## Set the stack up
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd ~/workspace/test # the sites folder the project is in
|
|
33
|
+
bash cmd-tools-testing.sh mysite # webship-js, the step pack, the users registry, a first feature
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For an Odoo project the setup adds the pack to `package.json`, lists its step definitions in
|
|
37
|
+
`cucumber.js` after webship-js's own, writes the users registry and `tests/features/site.feature`,
|
|
38
|
+
and makes sure the default accounts are on the site. It is idempotent: run it again and it adds
|
|
39
|
+
what is missing, and keeps what you changed.
|
|
40
|
+
|
|
41
|
+
## The order of work
|
|
42
|
+
|
|
43
|
+
1. **Read the installed steps.** They are the source of truth, not memory:
|
|
44
|
+
```bash
|
|
45
|
+
ls node_modules/@webship-js/odoo-steps/tests/step-definitions/
|
|
46
|
+
grep -n "^\(Given\|When\|Then\)" node_modules/@webship-js/odoo-steps/tests/step-definitions/odoo-webclient.steps.js
|
|
47
|
+
cat node_modules/@webship-js/odoo-steps/STEPS.md
|
|
48
|
+
```
|
|
49
|
+
Each step carries a JSDoc block with examples. The pack has step files for the session, the web
|
|
50
|
+
client (apps, menus, views, search, kanban), a record and its form (fields, tabs, lines,
|
|
51
|
+
dialogs, the chatter), and the website (pages, blog, shop, events, jobs, the contact form, the
|
|
52
|
+
editor). webship-js's own steps (status codes, classes, landmarks, accessibility) are in
|
|
53
|
+
`node_modules/webship-js/tests/step-definitions/`.
|
|
54
|
+
2. **Look at the site in the Playwright MCP browser first**, in a tab of your own: open the screen,
|
|
55
|
+
take a snapshot, do the thing by hand once. The web client is a single-page application: a
|
|
56
|
+
view, a form and a dialog exist only once they have rendered, and the label of a field is what
|
|
57
|
+
the screen shows, not the name of the field in the model. A scenario written without having
|
|
58
|
+
seen the screen asserts what you imagine. Close your tab when you are done; leave other tabs
|
|
59
|
+
alone.
|
|
60
|
+
3. **Write the scenario** from steps that exist. Run a dry run before a real one:
|
|
61
|
+
```bash
|
|
62
|
+
bash cmd-tools-testing.sh mysite --dry-run # every step matches one definition, no browser
|
|
63
|
+
```
|
|
64
|
+
4. **Run it**, narrow first, then the whole suite:
|
|
65
|
+
```bash
|
|
66
|
+
bash cmd-tools-testing.sh mysite --run --path tests/features/site.feature
|
|
67
|
+
bash cmd-tools-testing.sh mysite --run --tags "@critical"
|
|
68
|
+
bash cmd-tools-testing.sh mysite --run
|
|
69
|
+
```
|
|
70
|
+
5. **Read the result**: `tests/reports/cucumber_report.html`, the screenshot and the page dump of a
|
|
71
|
+
failed step in `tests/screenshots/`. Report what failed and why, not only that it failed.
|
|
72
|
+
|
|
73
|
+
## Accounts
|
|
74
|
+
|
|
75
|
+
A scenario logs in by a **handle** of the users registry (`worldParameters.users` in `cucumber.js`):
|
|
76
|
+
|
|
77
|
+
```gherkin
|
|
78
|
+
Given I am a logged in user with the "salesperson" user
|
|
79
|
+
Then I should see the "Sales" app
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| Handle | Account | What it may do |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `admin` | `administrator` | Every installed app, and the settings |
|
|
85
|
+
| `salesperson` | `salesperson` | Sales and CRM, own documents only; no Invoicing |
|
|
86
|
+
| `accountant` | `accountant` | Invoicing; no Sales, no CRM |
|
|
87
|
+
| `employee` | `employee` | An internal user with no app-specific group |
|
|
88
|
+
| `portal` | `portal` | A portal user: the website and `/my`, never the web client |
|
|
89
|
+
|
|
90
|
+
These are the default accounts (`bash cmd-tools-odoo-cli.sh mysite --add-users`). Override one for
|
|
91
|
+
another environment with `ODOO_<HANDLE>_USER` and `ODOO_<HANDLE>_PASSWORD`.
|
|
92
|
+
|
|
93
|
+
## Rules
|
|
94
|
+
|
|
95
|
+
- **Never create an account in a suite.** No user created in a hook, no scenario that adds a user
|
|
96
|
+
in the settings and leaves it behind, no signup scenario that leaves an account, no step that
|
|
97
|
+
adds one. Accounts are configuration: they are on the site before the suite runs. If a scenario
|
|
98
|
+
needs a kind of user the registry does not have, say so and ask for the account to be added to
|
|
99
|
+
the site and to the registry.
|
|
100
|
+
- **Never the workspace account.** The site's own administrator (the workspace account) is not in
|
|
101
|
+
the registry and its password goes in no file. `admin` in the registry is the `administrator`
|
|
102
|
+
default account.
|
|
103
|
+
- **No password in a feature file**, except where a wrong password is the subject of the scenario.
|
|
104
|
+
- **No platform name in a step phrase.** A step says what a person does or sees: `I open the
|
|
105
|
+
"Sales" app`, `I should see the list view`, `I set the "Customer" field to "…"`. Never a phrase
|
|
106
|
+
that names the product. The same holds for a custom step you write.
|
|
107
|
+
- **No CSS selector and no path in a scenario when a step of the pack says it.** `I am on the login
|
|
108
|
+
page`, not `/web/login`; `I open the "CRM" app`, not a menu id.
|
|
109
|
+
- **A custom step is the last resort.** Look in the pack and in webship-js first. If one is really
|
|
110
|
+
missing, write it in `tests/step-definitions/`, with a JSDoc block and examples like the pack's,
|
|
111
|
+
and say that it may belong upstream.
|
|
112
|
+
- **Records a scenario creates, it removes**, or it names them so a later run finds and clears
|
|
113
|
+
them. A suite leaves the site as it found it. The demo data is the site's content: assert on it,
|
|
114
|
+
do not change it. A site built with `--without-demo`, or with other apps, has none of it: say
|
|
115
|
+
which scenarios need the demo data or an app, rather than assuming them.
|
|
116
|
+
- **The site stays local.** Never point a scenario at an outside service, and never install or
|
|
117
|
+
enable a module that needs a vendor account. Community only, never the Enterprise edition.
|
|
118
|
+
- **Everything runs in the container.** Never `npx cucumber-js` or `npx playwright` on the host for
|
|
119
|
+
a project.
|
|
120
|
+
- **A failing suite is a result.** Do not tag a scenario `@wip`, raise a timeout or loosen an
|
|
121
|
+
assertion to make a run green. Say what the site did.
|
|
122
|
+
|
|
123
|
+
## A scenario, the way the pack reads
|
|
124
|
+
|
|
125
|
+
```gherkin
|
|
126
|
+
Feature: A salesperson works on quotations, not on invoices
|
|
127
|
+
|
|
128
|
+
Scenario: The salesperson has Sales and no Invoicing
|
|
129
|
+
Given I am a logged in user with the "salesperson" user
|
|
130
|
+
Then I should see the "Sales" app
|
|
131
|
+
But I should not see the "Invoicing" app
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Check every phrase against the installed definitions before you run it: the pack moves, and a phrase
|
|
135
|
+
from memory is a guess.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# workspace-name: Odoo 17 Community (apps, accounts, tests)
|
|
4
|
+
|
|
5
|
+
# Installed by the Odoo plugin (plugins.sh --install odoo); __WORKSPACE__ is the workspace it was installed into.
|
|
6
|
+
#
|
|
7
|
+
# Build an Odoo Community site in a container: Odoo 17.0, or the release --version names, on
|
|
8
|
+
# PostgreSQL, at https://<name>.ddev.site. With --install the database is created with the apps
|
|
9
|
+
# and Odoo's demo data, and the workspace account is its administrator; with --add-users it also
|
|
10
|
+
# gets the default accounts. Community only: no Enterprise, no vendor account.
|
|
11
|
+
|
|
12
|
+
# Bootstrap.
|
|
13
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
14
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
15
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
16
|
+
|
|
17
|
+
# Load workspace settings.
|
|
18
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
19
|
+
|
|
20
|
+
# Set site version.
|
|
21
|
+
site_version="17.0";
|
|
22
|
+
|
|
23
|
+
# Distribution.
|
|
24
|
+
distribution_name="odoo";
|
|
25
|
+
distribution_title="Odoo Community";
|
|
26
|
+
distribution_webroot="";
|
|
27
|
+
|
|
28
|
+
ARGPARSE_DESCRIPTION="Build an ${distribution_title} project in __WORKSPACE__"
|
|
29
|
+
# The args file comes with the plugin: core/scripts/plugins/odoo/ is where plugins.sh --install puts it.
|
|
30
|
+
source ${WORKSPACE_SCRIPTS}/plugins/odoo/args/arg-odoo.sh || exit 1 ;
|
|
31
|
+
|
|
32
|
+
shift $#;
|
|
33
|
+
|
|
34
|
+
odoo_build ;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Installed by the Odoo plugin (plugins.sh --install odoo); __WORKSPACE__ is the workspace it was installed into.
|
|
4
|
+
#
|
|
5
|
+
# odoo-bin for one Odoo project of this workspace, in its container: say what the site is, run
|
|
6
|
+
# an odoo-bin command, install apps, update the installed modules, restart Odoo, add or remove
|
|
7
|
+
# the default accounts. Nothing here runs on the host.
|
|
8
|
+
|
|
9
|
+
# Bootstrap.
|
|
10
|
+
# Find the workspace tooling from this script, so a fresh clone needs no setup.
|
|
11
|
+
WORKSPACE_SCRIPTS="${WORKSPACE_SCRIPTS:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../core/scripts" && pwd)}";
|
|
12
|
+
source ${WORKSPACE_SCRIPTS}/bootstrap.sh || exit 1 ;
|
|
13
|
+
|
|
14
|
+
# Load workspace settings.
|
|
15
|
+
eval $(parse_yaml ${WORKSPACE_CONFIG}/workspace.__WORKSPACE__.settings.yml);
|
|
16
|
+
|
|
17
|
+
# Distribution.
|
|
18
|
+
distribution_name="odoo";
|
|
19
|
+
|
|
20
|
+
ARGPARSE_DESCRIPTION="Run odoo-bin on an Odoo project of __WORKSPACE__: status, a command, apps, an update, a restart, the default accounts"
|
|
21
|
+
# The args file comes with the plugin: core/scripts/plugins/odoo/ is where plugins.sh --install puts it.
|
|
22
|
+
source ${WORKSPACE_SCRIPTS}/plugins/odoo/args/arg-odoo-cli.sh || exit 1 ;
|
|
23
|
+
|
|
24
|
+
shift $#;
|
|
25
|
+
|
|
26
|
+
odoo_cli_tool ;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Odoo Community for Webship Workspace: a platform plugin.
|
|
3
|
+
*
|
|
4
|
+
* What the package carries is placed by the installer from the manifest: the builder and the
|
|
5
|
+
* odoo-bin tool in the sites folders, their functions, argparse and the accounts script under
|
|
6
|
+
* core/scripts/plugins/odoo/, the agents in the AI Agents folder. The dashboard needs nothing
|
|
7
|
+
* drawn for it: the builder is in the Build list because it is a cmd-*-project.sh, the row menus
|
|
8
|
+
* are the core's, the agents are listed like any other. What register() adds is what the
|
|
9
|
+
* assistant is told.
|
|
10
|
+
*
|
|
11
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
12
|
+
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
13
|
+
*/
|
|
14
|
+
import type { PluginApi } from '@webship.co/workspace-plugin-api';
|
|
15
|
+
/** The plugin's name, which its functions are named after. */
|
|
16
|
+
export declare const PLATFORM = "odoo";
|
|
17
|
+
/** The commands the installer places in every sites folder. */
|
|
18
|
+
export declare const COMMANDS: string[];
|
|
19
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
20
|
+
export declare const AGENTS: string[];
|
|
21
|
+
/** What the assistant is told about Odoo in this workspace. */
|
|
22
|
+
export declare function assistantContext(): string;
|
|
23
|
+
export declare function register(api: PluginApi): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Odoo Community for Webship Workspace: a platform plugin.
|
|
4
|
+
*
|
|
5
|
+
* What the package carries is placed by the installer from the manifest: the builder and the
|
|
6
|
+
* odoo-bin tool in the sites folders, their functions, argparse and the accounts script under
|
|
7
|
+
* core/scripts/plugins/odoo/, the agents in the AI Agents folder. The dashboard needs nothing
|
|
8
|
+
* drawn for it: the builder is in the Build list because it is a cmd-*-project.sh, the row menus
|
|
9
|
+
* are the core's, the agents are listed like any other. What register() adds is what the
|
|
10
|
+
* assistant is told.
|
|
11
|
+
*
|
|
12
|
+
* Everything the dashboard is asked for goes through `api`; this package requires nothing from the
|
|
13
|
+
* dashboard's own files, so it can be installed from npm and removed without a trace.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AGENTS = exports.COMMANDS = exports.PLATFORM = void 0;
|
|
17
|
+
exports.assistantContext = assistantContext;
|
|
18
|
+
exports.register = register;
|
|
19
|
+
/** The plugin's name, which its functions are named after. */
|
|
20
|
+
exports.PLATFORM = 'odoo';
|
|
21
|
+
/** The commands the installer places in every sites folder. */
|
|
22
|
+
exports.COMMANDS = ['cmd-odoo-project.sh', 'cmd-tools-odoo-cli.sh'];
|
|
23
|
+
/** The agents the installer places in the AI Agents folder. */
|
|
24
|
+
exports.AGENTS = ['odoo-site-builder', 'odoo-tester'];
|
|
25
|
+
/** What the assistant is told about Odoo in this workspace. */
|
|
26
|
+
function assistantContext() {
|
|
27
|
+
return [
|
|
28
|
+
'Odoo Community (a plugin, @webship.co/workspace-odoo): an Odoo site is built with',
|
|
29
|
+
'`bash cmd-odoo-project.sh <name> --install --add-users` from a sites folder (dev, test, sandboxes, demos),',
|
|
30
|
+
'in containers like every other project, at https://<name>.ddev.site (the login at /web/login).',
|
|
31
|
+
'`bash cmd-tools-odoo-cli.sh <name>` says what the site is; `--run "<odoo-bin arguments>"` runs odoo-bin on its database,',
|
|
32
|
+
'`--install-apps <a,b>` installs apps, `--update` updates the installed modules, `--restart` starts Odoo again,',
|
|
33
|
+
'`--add-users` adds the default accounts (one per kind of user).',
|
|
34
|
+
'`bash cmd-tools-testing.sh <name>` sets up webship-js with the Odoo step pack; `--run` runs the suite.',
|
|
35
|
+
`For Odoo work, hand over to the agents ${exports.AGENTS.map((a) => `\`${a}\``).join(' and ')}.`,
|
|
36
|
+
'Community only: never the Enterprise edition, never a vendor account. Never run odoo, python or psql on the host for a project.',
|
|
37
|
+
'The example builder cmd-odoo20-project.sh of a sites folder is a different, simpler build; this plugin leaves it as it is.',
|
|
38
|
+
].join(' ');
|
|
39
|
+
}
|
|
40
|
+
function register(api) {
|
|
41
|
+
api.addAssistantContext(assistantContext);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAcH,4CAaC;AAED,4BAEC;AA3BD,8DAA8D;AACjD,QAAA,QAAQ,GAAG,MAAM,CAAC;AAE/B,+DAA+D;AAClD,QAAA,QAAQ,GAAG,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;AAEzE,+DAA+D;AAClD,QAAA,MAAM,GAAG,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;AAE3D,+DAA+D;AAC/D,SAAgB,gBAAgB;IAC9B,OAAO;QACL,mFAAmF;QACnF,4GAA4G;QAC5G,gGAAgG;QAChG,0HAA0H;QAC1H,gHAAgH;QAChH,iEAAiE;QACjE,wGAAwG;QACxG,0CAA0C,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG;QACxF,iIAAiI;QACjI,4HAA4H;KAC7H,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED,SAAgB,QAAQ,CAAC,GAAc;IACrC,GAAG,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Feature: The Odoo plugin on the dashboard
|
|
2
|
+
Once the plugin is activated and installed, the sites folders offer the Odoo builder, the
|
|
3
|
+
AI Agents folder lists the Odoo agents, and the Plugins page lists the plugin with its steps.
|
|
4
|
+
|
|
5
|
+
Scenario: The plugin is listed on the Plugins page
|
|
6
|
+
Given I am on "/settings/plugins"
|
|
7
|
+
Then I should see "Odoo"
|
|
8
|
+
And I should see "@webship.co/workspace-odoo"
|
|
9
|
+
|
|
10
|
+
Scenario: A sites folder offers the Odoo builder
|
|
11
|
+
Given I am on "/dev"
|
|
12
|
+
Then "option[value='cmd-odoo-project.sh']" should be attached
|
|
13
|
+
|
|
14
|
+
Scenario: The AI Agents folder lists the agents the plugin ships
|
|
15
|
+
Given I am on "/ai-agents"
|
|
16
|
+
Then I should see "odoo-site-builder"
|
|
17
|
+
And I should see "odoo-tester"
|