BaCheWork and records of a photonics research workhorse
Language

Want the conclusion first? Simple edition →

Running Odoo 20 locally: one pass through buying, selling and manufacturing

Runs the Odoo 20 Community edition on my own computer from the official Docker image, installs 12 apps with demo data, and then uses odoo shell scripts to check the sales, purchasing and manufacturing flows and the general ledger balance, once each. Includes the commands, script excerpts, measured numbers and the seven pitfalls I ran into.

Type
Note
Published
2026-11-30
Updated
2026-11-30

This is the technical edition: how to run Odoo 20 Community on your own computer, and how to use scripts to walk several business flows from start to finish. For the version without technical background, see “First time opening an ERP: going through buying, selling and making with Odoo”.

All numbers were measured on 2026-11-29 on a Windows 11 computer, with a single database; the data is the demo data plus a few documents and contacts created by the test scripts themselves.

The short answer

  • Two official images are all you need: odoo:20.0 plus postgres:17. Building a database with 12 apps and demo data took 2 minutes 34 seconds.
  • Demo data has to be enabled yourself: --with-demo must be added when the database is created; it is not installed by default.
  • Running scripts through odoo shell is the most convenient: it gets the whole system’s objects directly, with no need to log into the web interface and no API key.
  • All three flows work: sales, purchasing and manufacturing. Right after running all three, the debit and credit totals of the journal entries across the whole database were both 515,971.75.
  • I ran into seven pitfalls along the way, listed in the last section.

1. Environment

Item Value
Odoo Official image odoo:20.0, version 20.0-20261123; about 808 MB to download, 3.56 GB unpacked
Database Official image postgres:17; 671 MB unpacked
Idle memory Right after the database was created, Odoo used 277 MiB and PostgreSQL 192 MiB (measured with docker stats; it grows after running tests and opening the web page)
Database size The database itself is 125 MB (pg_database_size); the PostgreSQL data volume is 339 MB
Scale The image contains 704 modules (by the count of __manifest__.py files); I ended up installing 162 (the 12 apps and their dependencies, plus the course and payment modules added in section 6); 677 data models; 839 tables (plus 12 views)

compose.yml:

name: odoo-trial

services:
  db:
    image: postgres:17
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: odoo
    volumes:
      - db-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U odoo"]
      interval: 5s
      retries: 20

  odoo:
    image: odoo:20.0
    depends_on:
      db:
        condition: service_healthy
    environment:
      HOST: db
      USER: odoo
      PASSWORD: odoo
    ports:
      - "127.0.0.1:8069:8069"
    command: ["--database=trial", "--db-filter=^trial$$"]
    volumes:
      - odoo-data:/var/lib/odoo

volumes:
  db-data:
  odoo-data:

Two things to note:

  • The port is bound to 127.0.0.1, so only this computer can connect.
  • The database password odoo is only for local trials; it must be changed before use on any externally facing machine.

2. Creating the database

First start the database, then run the Odoo image once with “create the database, install modules, exit”:

docker compose up -d db
docker compose run --rm odoo odoo -d trial -i crm,sale_management,stock,account,project,website,website_sale,point_of_sale,mrp,hr,purchase,calendar --with-demo --load-language=zh_TW --stop-after-init
  • --with-demo: installs the demo data. odoo server --help lists --without-demo as the default, so leaving it out gives you an empty database.
  • --load-language=zh_TW: loads the Traditional Chinese language.
  • --stop-after-init: exits once installation is done, without leaving a server running.

After that, start normally:

docker compose up -d

Open http://localhost:8069 in the browser.

3. Running scripts with odoo shell

odoo shell opens a Python environment that has an object called env, which can read and write all data directly. Feed the script in through standard input to run it.

Two details:

  • Run it through the image’s /entrypoint.sh; it fills in the database connection settings in compose.yml (HOST, USER, PASSWORD) as Odoo parameters. Running odoo shell directly does not carry these settings, so you have to write the database host, user and password on the command line yourself.
  • PowerShell does not support the < input redirection operator. I used cmd /c to wrap it, and the Chinese characters in the script do not turn into question marks:
cmd /c "docker compose exec -T odoo /entrypoint.sh odoo shell -d trial --no-http < probes\flows.py"

The script’s skeleton: each flow is wrapped in a function; on success it calls commit, on failure it calls rollback and prints the error. That way one failing flow does not affect the others.

import traceback

def step(name, fn):
    print("FLOW ==", name)
    try:
        fn()
        env.cr.commit()
        print("FLOW OK", name)
    except Exception:
        env.cr.rollback()
        print("FLOW FAIL", name)
        print(traceback.format_exc()[-800:])

4. The three flows

Flow A: Opportunity → quote → delivery → invoice → payment

Below is a trimmed version, with the printing of results and the product picking removed:

partner = env["res.partner"].create({"name": "Flow A customer"})
lead = env["crm.lead"].create({"name": "Flow A", "partner_id": partner.id, "type": "opportunity"})
lead.action_set_won()

so = env["sale.order"].create({
    "partner_id": partner.id,
    "opportunity_id": lead.id,
    "order_line": [(0, 0, {"product_id": product.id, "product_uom_qty": 2})],
})
so.action_confirm()                      # the delivery order appears here

for picking in so.picking_ids:
    picking.action_assign()
    for move in picking.move_ids:
        move.quantity = move.product_uom_qty
        move.picked = True
    picking.button_validate()

inv = so._create_invoices()
inv.action_post()
wiz = env["account.payment.register"].with_context(
    active_model="account.move", active_ids=inv.ids).create({})
wiz.action_create_payments()

product is a product picked in advance that tracks inventory. Odoo 20 uses the field is_storable to decide this, not the old type = "product".

Output (excerpt):

sale order S00047 sale total 1725.0 pickings ['WH/OUT/00090']
picking WH/OUT/00090 delivery order -> done
on hand after 63.0            (before: 65.0)
invoice INV/2026/00010 posted 1725.0 payment not_paid
  line 400000 Product Sales        D     0.00 C 1500.00
  line 251000 Tax Received         D     0.00 C  225.00
  line 121000 Accounts Receivable  D  1725.00 C    0.00
after payment paid so invoice_status invoiced

Flow B: Purchase → receipt → vendor bill

The approach is the same as A: button_confirm() confirms the purchase order and the receipt is created automatically; after the goods are received, action_create_invoice() creates the bill, and you fill in the bill date and post it.

(This instance ran with the Chinese interface, so in the output below the bill’s journal prefix and the expense account name are shown translated.)

purchase order P00018 purchase receipts ['WH/IN/00013']
vendor bill BILL/2026/11/0005 posted 345.0
  line 600000 Expenses             D   300.00 C    0.00
  line 131000 Tax Paid             D    45.00 C    0.00
  line 211000 Accounts Payable     D     0.00 C  345.00

Flow C: Bill of materials → manufacturing order

bom = env["mrp.bom"].search([("type", "=", "normal")], limit=1)
product = bom.product_id or bom.product_tmpl_id.product_variant_id
mo = env["mrp.production"].create({"product_id": product.id, "product_qty": 1, "bom_id": bom.id})
mo.action_confirm()
mo.action_assign()
mo.qty_producing = 1
for m in mo.move_raw_ids:
    m.quantity = m.product_uom_qty
    m.picked = True
mo.button_mark_done()

The manufacturing order completed, but one component, the black drawer, was already short, so on-hand stock went to −1 after completion.

Flow D: General ledger balance

[(d, c)] = env["account.move.line"]._read_group(
    [("parent_state", "=", "posted")], [], ["debit:sum", "credit:sum"])
all posted lines debit 515971.75 credit 515971.75 equal True

5. Structure seen in the source code

The paths below are all under /usr/lib/python3/dist-packages/odoo/addons/ in the image.

  • Bridge module: sale_stock depends on sale and stock_account, and is set to auto-install. It overrides _action_confirm() on the sales order and calls _action_launch_stock_rule() inside it, which is how the delivery order gets created (sale_stock/models/sale_order.py). Of the 704 manifests in the image, 261 declare auto_install as True (installed automatically only when all of its dependencies are installed); another 147 use a list of module names (installed automatically when the listed ones are installed), for a total of 408 that install automatically.
  • Inventory valuation also goes into the general ledger: the _create_account_move() method of stock_account writes inventory moves as journal entries.
  • Debit–credit check: account/models/account_move.py contains _check_balanced().
  • Permissions are now in one table: in Odoo 20 permissions are stored in ir.access; one row holds the group, the model, the allowed operations (crud and combinations) and a data condition. Query it in odoo shell; the older ir.model.access and ir.rule models no longer exist; ir.access has 1,290 rows in total.
  • Public API: the new endpoint is /json/2/<model>/<method>, and it requires an API key in the Authorization header. I did not create a key; I only tested without one, and it returned 401 with a message asking for Bearer. rpc/controllers/__init__.py states that /xmlrpc, /xmlrpc/2 and /jsonrpc have been deprecated since Odoo 19 and are scheduled for removal in Odoo 22.
  • Payment transactions cannot be edited directly: a direct write() on a transaction is blocked, and the error message starts with “Payment transactions should not be updated directly”. It lists two options: use _record() to record the data sent by the payment provider and leave it to the scheduler; or, once you are sure the update can survive a rollback, pass the context payment_safe_write=True (payment/models/payment_transaction.py). The demo payment provider’s action_demo_set_done() takes the second route: it calls _process() directly under payment_safe_write=True. The source comment says this is to see the result immediately instead of waiting for the scheduler.

6. Extra test: selling online courses

I also installed website_slides (online courses), website_sale_slides (selling courses) and payment_demo (the demo payment provider), and tested once with a paid course from the demo data:

  1. Create a portal user and read a lesson that is not a preview; check_access("read") raises AccessError.
  2. Open a sales order to buy this course, and complete the payment with the demo payment provider.
  3. This user automatically becomes a course member, and can now read the same lesson.
  4. Call _remove_membership() to remove the membership: the membership record is archived (active = False), the lesson can no longer be read, and the two free preview lessons are still readable. The source docstring of this method says archiving is meant to keep learning progress; I did not test that separately.

The Community edition also includes the ECPay payment module payment_ecpay and Taiwan e-invoicing l10n_tw_edi_ecpay, both under LGPL-3. This time I only confirmed that they exist and did not actually connect them.

7. Seven pitfalls I ran into

  1. The bill of materials is attached to the product template: bom.product_id is often empty; use bom.product_tmpl_id.product_variant_id instead, or creating the manufacturing order will hit the database’s NOT NULL constraint.
  2. Argument order of _read_group: it is (domain, groupby, aggregates) (this has been the case since 17.0). Using the old style, with the aggregate field as the second argument, gives the error “Granularity set on a no-datetime field”.
  3. Verification inside the same odoo shell is unreliable: after removing the membership, checking right away in the same odoo shell still showed the lesson as readable; re-checking in a new odoo shell showed it was no longer readable. I guess it is a cache within the same process, though I did not trace which layer. Permissions have to be verified in a new process.
  4. POS demo data failed to install: the cash journal code of both demo shops is cash-none, so the second one could not be created, and Odoo switched to installing POS without demo data, so no shop exists. I guess the Chinese names turned into the same string when converted to codes; I did not check against an English database.
  5. The same invoice number appears twice: the demo data has three companies, and INV/2026/00010 exists once in each of two of them. When looking up a document by number, add a company condition.
  6. Negative stock is not blocked: in Flow C the drawer went to −1 and the system did not block it. I found no field on locations, products or product categories that blocks negative stock.
  7. Git Bash rewrites paths: running docker compose exec odoo /entrypoint.sh … in Git Bash converts /entrypoint.sh to C:/Program Files/Git/entrypoint.sh, and the container cannot find the file. Adding MSYS_NO_PATHCONV=1 in front fixes it; PowerShell does not have this problem.

One more item that is not really a pitfall: when I logged in with the demo credentials, Chrome showed a “leaked password” warning. Odoo’s source has no such check (grep for pwned, breach and leaked password finds no related files), so the warning came from Chrome itself; according to the warning, this common credential pair is on a known breach list.

8. Cleanup

To stop but keep the data:

docker compose stop

To delete everything, including the database:

docker compose down -v

To reclaim the image space:

docker image rm odoo:20.0 postgres:17

9. What I did not do

  • I did not actually call the JSON-2 API; I only tested that a request without a key is rejected.
  • I did not connect ECPay or any real payment provider.
  • I did not compare other ERP systems, nor estimate the hosting cost of a production launch.

10. Demo data and licensing

  • Data: the output and screenshots in this article come from the Odoo demo data loaded by --with-demo, plus the test records this article’s scripts created (names carry Flow A, Flow B, Flow M). The companies, people and documents in the demo data are content bundled with Odoo, not real transactions.
  • Software license: the LICENSE file of odoo/odoo states that it is released under LGPL-3. The COPYRIGHT file says the copyright of most files belongs to Odoo S.A.; for the copyright of third-party contributions, see the version history, the notices inside the files, or their own COPYRIGHT / LICENSE files.
  • What was installed this time: the trial database has 162 modules installed; querying the license field of ir.module.module in odoo shell shows that all of them are LGPL-3. The image’s addons/ folder also contains a batch of theme_* themes, whose LICENSE is the Odoo Proprietary License v1.0; none of them were installed this time, and the website uses the default look. No paid-version modules were used.
  • Docker image: on Docker Hub, odoo is a Docker Official Image, and the page says it is maintained by Odoo (odoo/docker). The page also notes that the image contains other software under other licenses (such as base system packages), and that making sure the use complies with those licenses is the responsibility of the image’s user.
  • Screenshots: I took them on my own machine. I did not trace the sources of the product photos, course images and avatars in the demo data one by one, so I blurred them with a CSS filter before taking the screenshots.
  • Trademark: Odoo is a name and trademark of Odoo S.A. This article is a personal trial record; it has no partnership, sponsorship or agency relationship with the Odoo company. Odoo’s brand page states that partner logos may only be used by official partners, and this article does not use one.

Sources

  1. odoo/odoo (source code). GitHub. (Branch 20.0; file paths cited in the text refer to the 20.0-20261123 version inside the image)
  2. odoo/odoo: LICENSE (LGPL-3). GitHub.
  3. odoo/odoo: COPYRIGHT. GitHub.
  4. Odoo. Brand assets. (The partner logo may only be used by official Odoo partners; accessed 2026-11-29)
  5. odoo/docker (official image build files). GitHub.
  6. Official Odoo Docker image. Docker Hub. (This time I used odoo:20.0 (20.0-20261123); postgres:17 is another official image)
  7. Odoo. External JSON-2 API (Odoo 20.0 documentation). (Accessed 2026-11-29)

← Previous:From a seed: my AI assistant Qizhe, and a starter seed kit for newcomers to agents