git mv preserves history. fusion_accounting/ retains only __manifest__.py, __init__.py, CLAUDE.md, and docs/ — the meta-module shell. All Python, data, views, security, services, static, tests, wizards, report move to fusion_accounting_ai/. Manifest data list updated; security.xml move to _core deferred to Task 12. Made-with: Cursor
61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
import logging
|
|
from odoo import models, fields, api
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class FusionAccountingSession(models.Model):
|
|
_name = 'fusion.accounting.session'
|
|
_description = 'Fusion Accounting AI Session'
|
|
_order = 'create_date desc'
|
|
_inherit = ['mail.thread']
|
|
|
|
name = fields.Char(
|
|
string='Session',
|
|
required=True,
|
|
default=lambda self: self.env['ir.sequence'].next_by_code('fusion.accounting.session') or 'New',
|
|
)
|
|
user_id = fields.Many2one(
|
|
'res.users', string='User',
|
|
required=True, default=lambda self: self.env.user,
|
|
index=True,
|
|
)
|
|
company_id = fields.Many2one(
|
|
'res.company', string='Company',
|
|
required=True, default=lambda self: self.env.company,
|
|
)
|
|
state = fields.Selection(
|
|
selection=[
|
|
('active', 'Active'),
|
|
('closed', 'Closed'),
|
|
],
|
|
string='Status',
|
|
default='active',
|
|
index=True,
|
|
)
|
|
message_ids_json = fields.Text(
|
|
string='Messages (JSON)',
|
|
default='[]',
|
|
help='Stored conversation messages as JSON array.',
|
|
)
|
|
context_domain = fields.Char(
|
|
string='Context Domain',
|
|
help='Active accounting domain when session started.',
|
|
)
|
|
context_data = fields.Text(
|
|
string='Context Data (JSON)',
|
|
help='Additional Odoo context captured at session start.',
|
|
)
|
|
match_history_ids = fields.One2many(
|
|
'fusion.accounting.match.history', 'session_id',
|
|
string='Match History',
|
|
)
|
|
token_count_in = fields.Integer(string='Tokens In', default=0)
|
|
token_count_out = fields.Integer(string='Tokens Out', default=0)
|
|
tool_call_count = fields.Integer(string='Tool Calls', default=0)
|
|
ai_provider = fields.Char(string='AI Provider')
|
|
ai_model = fields.Char(string='AI Model')
|
|
|
|
def action_close_session(self):
|
|
self.write({'state': 'closed'})
|