Code reuse:
- formatRecordsForWeb() consolidates 4-call formatting sequence
(was duplicated in handleWebSearchRead + handleWebRead)
- ToRecordID() public alias for cross-package ID extraction
Performance:
- M2O NameGet now batched: collect all FK IDs per field, single
NameGet per comodel instead of per-record (N+1 → 1)
Quality:
- normalizeNullFields: 30-line switch (all returning false) → 5 lines
- domain.go: remove unused _ = subParams assignment
- Net -14 lines
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a view specification requests O2M fields (e.g., order_line on
sale.order), the response now includes the child records as an array
of dicts. Searches child model by inverse_field = parent_id, reads
requested sub-fields, and formats M2O/dates/nulls on children too.
This makes inline list views in form notebooks show actual data:
- Sale order lines (product, qty, price) in sale.order form
- Invoice lines in account.move form
- Any O2M field with specification in get_views response
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The web client needs field metadata for sub-models when rendering
inline list views inside form views (e.g., sale.order.line inside
sale.order form). Now iterates all relational fields and adds their
comodel to the models dict in the get_views response.
Fixes "Cannot read properties of undefined (reading 'fields')" error
on sale.order and account.move stored form views with O2M tabs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Batch 1 (quick-fixes):
- Field.Copy attribute + IsCopyable() method for copy control
- Constraints now run in Write() (was only Create — bug fix)
- Readonly fields silently skipped in Write()
- active_test: auto-filter archived records in Search()
Batch 2 (Related field write-back):
- preprocessRelatedWrites() follows FK chain and writes to target model
- Enables Settings page to edit company name/address/etc.
- Loop protection via _write_related_depth context counter
Batch 3 (_inherits delegation):
- SetupAllInherits() generates Related fields from parent models
- preprocessInheritsCreate() auto-creates parent records on Create
- Declared on res.users, res.company, product.product
- Called in LoadModules before compute setup
Batch 4 (Copy method):
- Recordset.Copy(defaults) with blacklist, IsCopyable check
- M2M re-linking, rec_name "(copy)" suffix
- Replaces simplified copy case in server dispatch
Batch 5 (Onchange compute):
- RunOnchangeComputes() triggers dependent computes on field change
- Virtual record (ID=-1) with client values in cache
- Integrated into onchange RPC handler
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 1: read_group/web_read_group with SQL GROUP BY, aggregates
(sum/avg/min/max/count/array_agg/sum_currency), date granularity,
M2O groupby resolution to [id, display_name].
Phase 2: Record rules with domain_force parsing (Python literal parser),
global AND + group OR merging. Domain operators: child_of, parent_of,
any, not any compiled to SQL hierarchy/EXISTS queries.
Phase 3: Button dispatch via /web/dataset/call_button, method return
values interpreted as actions. Payment register wizard
(account.payment.register) for sale→invoice→pay flow.
Phase 4: ir.filters, ir.default, product fields expanded, SO line
product_id onchange, ir_model+ir_model_fields DB seeding.
Phase 5: CSV export (/web/export/csv), attachment upload/download
via ir.attachment, fields_get with aggregator hints.
Admin/System: Session persistence (PostgreSQL-backed), ir.config_parameter
with get_param/set_param, ir.cron, ir.logging, res.lang, res.config.settings
with company-related fields, Settings form view. Technical menu with
Views/Actions/Parameters/Security/Logging sub-menus. User change_password,
preferences. Password never exposed in UI/API.
Bugfixes: false→nil for varchar/int fields, int32 in toInt64, call_button
route with trailing slash, create_invoices returns action, search view
always included, get_formview_action, name_create, ir.http stub.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Normalize null DB values to false (Odoo convention) in web_search_read
and web_read responses
- Seed stock reference data: 6 locations, 1 warehouse, 3 picking types
- Fix FK order: warehouse must be created before picking types
- Move action_get from hardcoded dispatcher to res.users RegisterMethod
- Add action_res_users_my (ID 103) to seedActions
- Remove hardcoded action_get case from dispatchORM
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces all hardcoded Go maps with database-driven loading:
Menus (pkg/server/menus.go):
- Queries ir_ui_menu table joined with ir_model_data for XML IDs
- Builds parent/child tree from parent_id relationships
- Resolves appID by walking up to top-level ancestor
- Parses action references ("ir.actions.act_window,123" format)
Actions (pkg/server/action.go):
- Loads from ir_actions_act_window table by integer ID
- Supports XML ID resolution ("sale.action_quotations_with_onboarding")
via ir_model_data lookup
- Builds views array from view_mode string dynamically
- Handles nullable DB columns with helper functions
Seed data (pkg/service/db.go):
- seedActions(): 15 actions with XML IDs in ir_model_data
- seedMenus(): 25 menus with parent/child hierarchy and XML IDs
- Both called during database creation
This mirrors Python Odoo's architecture where menus and actions
are database records loaded from XML data files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
P0: Fix sale.order creation (was completely broken)
- Corrected M2M junction table name from sale_order_line_account_tax_rel
to account_tax_sale_order_line_rel (ORM sorts alphabetically)
- Added fallback in BeforeCreate if sequence generation fails
P1: Add display_name as magic field on ALL models
- Added to addMagicFields() in pkg/orm/model.go (like Python BaseModel)
- Computed on-the-fly in Read() from recName field, no DB column
- Removed explicit display_name from res.partner (now auto-inherited)
P2: Add DefaultGet hooks for sale.order and purchase.order
- Sets company_id, currency_id, date_order/date_planned from environment
- Follows same pattern as account.move's DefaultGet
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- res.users.action_get() RPC: returns preferences action (form dialog)
- /web/session/account endpoint: returns Odoo.com account URL
- /web/session/logout: clears session, redirects to login (was already done)
- support_url set to odoo.com/help (enables Help menu item)
- notification_type + display_switch_company_menu in session_info
- Image handler: path-style URL parsing for avatars
All user dropdown items now work:
Help → opens odoo.com/help
Shortcuts → opens command palette (client-side)
My Preferences → opens user form dialog
My Odoo.com Account → opens accounts.odoo.com
Log out → clears session, redirects to login
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Image handler now returns SVG placeholders for company logo and user
avatars instead of broken 1x1 PNG (fixes yellow border in navbar)
- Supports both query-param (?model=&field=) and path-style URLs
(/web/image/res.partner/2/avatar_128)
- Added Settings app menu with Users & Technical sub-menus
- Added actions for Settings (company form), Users list, Sequences
- Added /web/session/logout handler that clears session + cookie
- Added logout to middleware whitelist
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Copy build/odoo_web.css to frontend/web/static/ so it's served correctly
- Handle /odoo/<addon>/static/ paths in static file handler (strip odoo/ prefix)
- Route /odoo/ paths with /static/ to static handler instead of webclient
All CSS now loads correctly: Bootstrap, FontAwesome, Odoo UI icons, modules.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The injectXmlSpacePreserve function was inserting the attribute AFTER
the self-closing slash in tags like <t t-name="foo"/>, producing
invalid XML: <t t-name="foo"/ xml:space="preserve">
Now correctly inserts before the slash:
<t t-name="foo" xml:space="preserve"/>
This fixes the "attributes construct error at column 33" that appeared
as a red banner in the Odoo webclient list view.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Transpiler fixes:
- export function declarations now use hoisted function syntax instead
of var assignments, fixing modules that reference functions before
their declaration (e.g., rpc.setCache before export function rpc)
- Re-export paths (export { X } from "./relative") now resolve to
full module names in require() calls
DB seed fixes:
- Remove SQL comments from multi-value INSERT (pgx doesn't support --)
- Split multi-statement setval into individual Exec calls
Middleware:
- Add /web/database/* to public endpoint whitelist
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Improved auto-generated list/form/search views with priority fields,
two-column form layout, statusbar widget, notebook for O2M fields
- Enhanced fields_get with currency_field, compute, related metadata
- Fixed session handling: handleSessionInfo/handleSessionCheck use real
session from cookie instead of hardcoded values
- Added read_progress_bar and activity_format RPC stubs
- Improved bootstrap translations with lang_parameters
- Added "contacts" to session modules list
Server starts successfully: 14 modules, 93 models, 378 XML templates,
503 JS modules transpiled — all from local frontend/ directory.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Copy all OWL frontend assets (JS/CSS/XML/fonts/images) into frontend/
directory (2925 files, 43MB) — no more runtime reads from Python Odoo
- Replace OdooAddonsPath config with FrontendDir pointing to local frontend/
- Rewire bundle.go, static.go, templates.go, webclient.go to read from
frontend/ instead of external Python Odoo addons directory
- Auto-detect frontend/ and build/ dirs relative to binary in main.go
- Delete obsolete Python helper scripts (tools/*.py)
The Go server is now fully self-contained: single binary + frontend/ folder.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Full port of Odoo's ERP system from Python to Go, with the original
Odoo JavaScript frontend (OWL framework) running against the Go server.
Backend (10,691 LoC Go):
- Custom ORM: CRUD, domains→SQL with JOINs, computed fields, sequences
- 93 models across 14 modules (base, account, sale, stock, purchase, hr,
project, crm, fleet, product, l10n_de, google_address/translate/calendar)
- Auth with bcrypt + session cookies
- Setup wizard (company, SKR03 chart, admin, demo data)
- Double-entry bookkeeping constraint
- Sale→Invoice workflow (confirm SO → generate invoice → post)
- SKR03 chart of accounts (110 accounts) + German taxes (USt/VSt)
- Record rules (multi-company filter)
- Google integrations as opt-in modules (Maps, Translate, Calendar)
Frontend:
- Odoo's original OWL webclient (503 JS modules, 378 XML templates)
- JS transpiled via Odoo's js_transpiler (ES modules → odoo.define)
- SCSS compiled to CSS (675KB) via dart-sass
- XML templates compiled to registerTemplate() JS calls
- Static file serving from Odoo source addons
- Login page, session management, menu navigation
- Contacts list view renders with real data from PostgreSQL
Infrastructure:
- 14MB single binary (CGO_ENABLED=0)
- Docker Compose (Go server + PostgreSQL 16)
- Zero phone-home (no outbound calls to odoo.com)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>