ORM:
- ExtendModel(name) retrieves existing model for extension (mirrors
Python _inherit without _name). Panics on missing model.
- RegisterInverse(fieldName, fn) convenience for computed write-back
- Inverse field handling in Write(): caches new value, calls inverse
method so computed fields can be written back
Sale module:
- Extends res.partner with sale_order_ids (O2M) and sale_order_count
(computed) via ExtendModel — demonstrates real _inherit pattern
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pgx v5 returns PostgreSQL numeric as pgtype.Numeric (not float64)
when scanning into interface{}. The reconcile method now reads line
data directly via SQL with ::float8 casts instead of ORM Read().
Verified end-to-end: Invoice receivable (1000) + Payment credit (-1000)
→ partial_reconcile created → residuals zeroed → full_reconcile created
→ invoice payment_state = 'paid'.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The INSERT INTO stock_move_line was missing product_uom_id and date
columns which are NOT NULL. Now copies product_uom and date from the
parent stock_move record.
Full stock flow now works:
- Confirm: reserves quants (qty=100, reserved=5)
- Move state: draft → assigned (with move_line created)
- Validate: source quant 100→95, dest quant 0→5, state → done
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Account Reconciliation Engine:
- reconcile() method on account.move.line matches debit↔credit lines
- Creates account.partial.reconcile records for each match
- Detects full reconciliation (all residuals=0) → account.full.reconcile
- updatePaymentState() tracks paid/partial/not_paid on invoices
- Payment register wizard now creates journal entries + reconciles
Stock Quant Reservation:
- assignMove() reserves products from source location quants
- getAvailableQty() queries unreserved on-hand stock
- _action_confirm → confirmed + auto-assigns if stock available
- _action_assign creates stock.move.line reservations
- _action_done updates quants (decrease source, increase dest)
- button_validate on picking delegates to move._action_done
- Clears reserved_quantity on completion
Sale Invoice Creation (rewritten):
- Proper debit/credit/balance on invoice lines
- Tax computation from SO line M2M tax_ids (percent/fixed/division)
- Revenue account lookup (SKR03 8300 with fallbacks)
- amount_residual set on receivable line (enables reconciliation)
- qty_invoiced tracking on SO lines
- Line amount computes now include tax in price_total
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>
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>
- 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>
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>