19 lines
574 B
Python
19 lines
574 B
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
|
|
from . import models
|
|
from . import controllers
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
def post_init_hook(env):
|
|
"""Give the built-in agent a partner so it can post in Discuss."""
|
|
agent = env.ref('dn_ai.ai_default_agent', raise_if_not_found=False)
|
|
if agent and not agent.partner_id:
|
|
agent.partner_id = env['res.partner'].create({
|
|
'name': agent.name or 'AI Assistant',
|
|
'is_company': False,
|
|
})
|
|
_logger.info("dn_ai: post-install ready (agent=%s)", agent.name if agent else 'none')
|