Commit Graph

13 Commits

Author SHA1 Message Date
Carlos Garcia
beb08b0b4b fix(addon): seed ab.ai.bot and agent registry on install
The bot DM flow silently failed because ab_ai_mail.message_post override
bails when no active ab.ai.bot row exists, and the agent service loaded
0 agents from an empty ab.ai.agent.registry. Both tables stayed empty
because nothing populated them.

The post_init/post_migrate hook now seeds:
- One active ab.ai.bot pointing at http://activeblue-agent:8001
- The 8 specialist agents (finance, accounting, crm, sales, project,
  elearning, expenses, hr) plus master, all on the ollama backend

Idempotent: skips rows that already exist.
2026-04-24 22:51:37 -04:00
Carlos Garcia
79537a5e21 fix(addon): create AI bot as Confirmed (skip invitation email)
The post_init/post_migrate hook now:
- Uses no_reset_password context to skip Odoo's invitation email flow
- Writes a res_users_log row so the user shows as Confirmed instead of
  Pending Invitations (Odoo 18 derives state from log presence)
- Idempotently ensures the partner_activeblue_ai external ID points at
  the bot's partner so env.ref() resolves in ab_ai_mail.py

Discovered while fixing the bot DM flow on miaai: even after the user
was created, Discuss showed it as Pending until a res_users_log row was
inserted manually.
2026-04-24 22:49:42 -04:00
Carlos Garcia
01f7037a38 fix(addon): create AI bot as internal user; use post_migrate_hook
- Bot needs to be a res.users to appear in Discuss DM search
- post_migrate_hook runs on both install and -u update
- Idempotent: skips creation if user already exists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:20:09 -04:00
Carlos Garcia
d5381220fb fix(addon): create bot partner via post_init_hook instead of XML
XML record creation bypasses ORM defaults causing NOT NULL violation
on autopost_bills (added by account module). Hook uses ORM create()
which applies all field defaults correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:17:43 -04:00
Carlos Garcia
65957339ef fix(addon): inherit discuss.channel not mail.channel (renamed in Odoo 17+)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:15:46 -04:00
Carlos Garcia
e3ef649ee6 fix(addon): remove discuss from depends (included in mail in Odoo 18)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:15:08 -04:00
Carlos Garcia
992d2c2775 feat(addon): add ActiveBlue AI bot to Odoo Discuss
- Create res.partner for the AI bot (appears in DM contacts)
- Override mail.channel.message_post to intercept direct messages
  to the bot partner and forward them to the agent service
- Post the agent reply back into the Discuss channel as the bot
- Add discuss to depends; load res_partner_bot.xml data

Users can now open Discuss -> New Message -> search 'ActiveBlue AI'
to start a conversation with the agent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 22:14:00 -04:00
Carlos Garcia
6cb09282c2 fix(addon): replace useService('rpc') with direct rpc import for Odoo 18
rpc service was removed in Odoo 17+. Import rpc function directly from
@web/core/network/rpc instead of using useService('rpc').

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 21:44:59 -04:00
Carlos Garcia
86708f09eb fix(addon): replace deprecated attrs with Odoo 17+ inline expressions
attrs={'invisible': [...]} syntax was removed in Odoo 17.
Converted all occurrences to inline invisible= expressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 21:23:15 -04:00
Carlos Garcia
15afe51d9c fix(addon): resolve all Odoo 18 install errors
- security/res_groups.xml: fully qualify ref('group_ai_user') with module prefix
- data/ir_cron.xml: remove numbercall field (removed in Odoo 17/18)
- views/menus.xml: remove web_icon referencing missing static/src/img/icon.png
- controllers/webhook.py: use get_json() instead of deprecated json.loads(data)
- security/ir.model.access.csv: use fully-qualified group external IDs (prior commit)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 21:20:40 -04:00
Carlos Garcia
a4759b583e fix(addon): use fully-qualified external IDs in access CSV
group_ai_manager -> activeblue_ai.group_ai_manager to ensure Odoo
resolves the group reference correctly regardless of load order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 19:23:36 -04:00
Carlos Garcia
cd606a1db8 fix(addon): load res_groups.xml before ir.model.access.csv
CSV references group_ai_manager and group_ai_user which must be
created before the access rules that reference them.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 19:21:40 -04:00
ActiveBlue Build
29409ed71d feat(odoo): add activeblue_ai Odoo 18 module with OWL2 frontend
Models:
- ab.ai.bot: service URL, webhook secret, privacy mode, ping/dispatch
- ab.ai.directive: full directive lifecycle log with status tracking
- ab.ai.log: activity log with level/agent/record linkage
- ab.ai.agent.registry: agent list synced from agent service

Controllers:
- webhook.py: /ai/webhook/callback handles directive_completed, escalation, sweep_findings
- health_proxy.py: /ai/health proxies agent service detailed health
- approval.py: /ai/chat dispatch, /ai/approval/pending, /ai/approval/respond

Security:
- group_ai_user (chat) + group_ai_manager (configure, approve, logs)
- ir.model.access.csv for all 4 models

Views: list/form for bot, directives, logs, registry; main menu with AI brain icon

OWL2 frontend:
- systray_button.js: brain icon in top bar, status dot, pending approval badge
- ai_panel.js: slide-in chat panel, approval workflow, 30s poll for pending items
- CSS: slide-in animation, message bubbles, loading dots, approval section

Data: 4 cron jobs (ping, registry sync, directive/log cleanup)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 17:59:02 -04:00