Files
silo/internal/odoo/types.go
Forbes 7550b78740 feat: Infor-style split-panel layout, projects page, fuzzy search, Odoo scaffold
Web UI - Infor CloudSuite-style split-panel layout (items.html rewrite):
- Replace modal-based item detail with inline split-panel workspace
- Horizontal mode: item list on left, tabbed detail panel on right
- Vertical mode: detail panel on top, item list below
- Detail tabs: Main, Properties, Revisions, BOM, Where Used
- Ctrl+F opens in-page filter overlay with fuzzy search
- Column config gear icon with per-layout-mode persistence
- Search scope toggle pills (All / Part Number / Description)
- Selected row highlight with accent border
- Responsive breakpoint forces vertical below 900px
- Create/Edit/Delete remain as modal dialogs

Web UI - Projects page:
- New projects.html template with full CRUD
- Project table: Code, Name, Description, Item count, Created, Actions
- Create/Edit/Delete modals
- Click project code navigates to items filtered by project
- 3-tab navigation in base.html: Items, Projects, Schemas

Fuzzy search:
- Add sahilm/fuzzy dependency for ranked text matching
- New internal/api/search.go with SearchableItems fuzzy.Source
- GET /api/items/search endpoint with field scope and type/project filters
- Frontend routes to fuzzy endpoint when search input is non-empty

Odoo ERP integration scaffold:
- Migration 008: integrations and sync_log tables
- internal/odoo/ package: types, client stubs, sync stubs
- internal/db/integrations.go: IntegrationRepository
- internal/config/config.go: OdooConfig struct
- 6 API endpoints for config CRUD, sync log, test, push, pull
- All sync operations return stub responses

Documentation:
- docs/REPOSITORY_STATUS.md: comprehensive repository state report
  with architecture overview, API surface, feature stubs, and
  potential issues analysis
2026-01-31 09:20:27 -06:00

88 lines
2.8 KiB
Go

package odoo
import "time"
// Config holds Odoo connection configuration.
type Config struct {
URL string `json:"url" yaml:"url"`
Database string `json:"database" yaml:"database"`
Username string `json:"username" yaml:"username"`
APIKey string `json:"api_key" yaml:"api_key"`
FieldMap map[string]string `json:"field_map,omitempty" yaml:"field_map,omitempty"`
}
// JSONRPCRequest is the Odoo JSON-RPC request envelope.
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
ID int `json:"id"`
Params any `json:"params"`
}
// JSONRPCResponse is the Odoo JSON-RPC response envelope.
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
ID int `json:"id"`
Result any `json:"result,omitempty"`
Error *struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
} `json:"error,omitempty"`
}
// ProductProduct maps to the Odoo product.product model.
type ProductProduct struct {
ID int `json:"id"`
DefaultCode string `json:"default_code"` // maps to part_number
Name string `json:"name"` // maps to description
Type string `json:"type"`
ListPrice float64 `json:"list_price"`
Active bool `json:"active"`
}
// ProductTemplate maps to the Odoo product.template model.
type ProductTemplate struct {
ID int `json:"id"`
DefaultCode string `json:"default_code"`
Name string `json:"name"`
Type string `json:"type"`
ListPrice float64 `json:"list_price"`
Active bool `json:"active"`
}
// SyncDirection indicates the direction of a sync operation.
type SyncDirection string
const (
SyncPush SyncDirection = "push"
SyncPull SyncDirection = "pull"
)
// SyncStatus indicates the status of a sync operation.
type SyncStatus string
const (
SyncPending SyncStatus = "pending"
SyncRunning SyncStatus = "running"
SyncCompleted SyncStatus = "completed"
SyncFailed SyncStatus = "failed"
)
// SyncLogEntry represents a single sync operation record.
type SyncLogEntry struct {
ID string `json:"id"`
IntegrationID string `json:"integration_id"`
ItemID *string `json:"item_id,omitempty"`
Direction SyncDirection `json:"direction"`
Status SyncStatus `json:"status"`
ExternalID string `json:"external_id,omitempty"`
ExternalModel string `json:"external_model,omitempty"`
RequestPayload any `json:"request_payload,omitempty"`
ResponsePayload any `json:"response_payload,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
}