Files
Odoo-Modules/fusion_accounting_ai/wizards/rule_wizard.py
gsinghpal 6c72f2ab49 refactor(fusion_accounting): move AI module code into fusion_accounting_ai sub-module
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
2026-04-18 21:45:06 -04:00

43 lines
1.6 KiB
Python

from odoo import models, fields, api
class FusionRuleWizard(models.TransientModel):
_name = 'fusion.accounting.rule.wizard'
_description = 'Create Fusion Rule from AI Suggestion'
name = fields.Char(string='Rule Name', required=True)
rule_type = fields.Selection(
selection=[
('match', 'Match'), ('classify', 'Classify'),
('audit', 'Audit'), ('fee', 'Fee'),
('routing', 'Routing'), ('followup', 'Follow-Up'),
],
string='Type', required=True, default='match',
)
description = fields.Text(string='Description')
match_logic = fields.Text(string='Match Logic')
fee_account_id = fields.Many2one('account.account', string='Fee Account')
write_off_account_id = fields.Many2one('account.account', string='Write-Off Account')
journal_ids = fields.Many2many('account.journal', string='Journals')
def action_create_rule(self):
self.ensure_one()
rule = self.env['fusion.accounting.rule'].create({
'name': self.name,
'rule_type': self.rule_type,
'description': self.description,
'match_logic': self.match_logic,
'fee_account_id': self.fee_account_id.id,
'write_off_account_id': self.write_off_account_id.id,
'journal_ids': [(6, 0, self.journal_ids.ids)],
'created_by': 'admin',
'approval_tier': 'needs_approval',
})
return {
'type': 'ir.actions.act_window',
'res_model': 'fusion.accounting.rule',
'res_id': rule.id,
'view_mode': 'form',
'target': 'current',
}