Files
Odoo-Modules/fusion_accounting_bank_rec/models/fusion_bank_rec_widget.py
2026-04-19 10:45:30 -04:00

34 lines
1.4 KiB
Python

"""Per-request widget state. Holds the kanban-load response shape so the
controller can return one well-typed object.
This is a TransientModel (no DB persistence beyond the request). The OWL
widget reads pre-computed fusion.reconcile.suggestion rows directly via
the controller; this model is just a typed envelope for the kanban-open
action."""
from odoo import api, fields, models
class FusionBankRecWidget(models.TransientModel):
_name = "fusion.bank.rec.widget"
_description = "Bank reconciliation widget state (transient)"
journal_id = fields.Many2one('account.journal',
domain="[('type', '=', 'bank')]")
statement_line_ids = fields.Many2many('account.bank.statement.line')
summary_count = fields.Integer(
help="Number of unreconciled lines visible in this widget")
summary_unreconciled_balance = fields.Monetary(currency_field='currency_id')
currency_id = fields.Many2one('res.currency',
related='journal_id.currency_id',
store=False, readonly=True)
def action_open_kanban(self):
"""Return a window action opening the OWL kanban for this journal."""
self.ensure_one()
return {
'type': 'ir.actions.client',
'tag': 'fusion_bank_rec_kanban',
'params': {'journal_id': self.journal_id.id},
}