Initial commit
This commit is contained in:
48
fusion_faxes/models/fusion_fax_document.py
Normal file
48
fusion_faxes/models/fusion_fax_document.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class FusionFaxDocument(models.Model):
|
||||
_name = 'fusion.fax.document'
|
||||
_description = 'Fax Document Line'
|
||||
_order = 'sequence, id'
|
||||
|
||||
fax_id = fields.Many2one(
|
||||
'fusion.fax',
|
||||
string='Fax',
|
||||
required=True,
|
||||
ondelete='cascade',
|
||||
)
|
||||
sequence = fields.Integer(
|
||||
string='Order',
|
||||
default=10,
|
||||
)
|
||||
attachment_id = fields.Many2one(
|
||||
'ir.attachment',
|
||||
string='Document',
|
||||
required=True,
|
||||
ondelete='cascade',
|
||||
)
|
||||
file_name = fields.Char(
|
||||
related='attachment_id.name',
|
||||
string='File Name',
|
||||
)
|
||||
mimetype = fields.Char(
|
||||
related='attachment_id.mimetype',
|
||||
string='Type',
|
||||
)
|
||||
|
||||
def action_preview(self):
|
||||
"""Open the attachment in Odoo's built-in PDF viewer dialog."""
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'fusion_claims.preview_document',
|
||||
'params': {
|
||||
'attachment_id': self.attachment_id.id,
|
||||
'title': self.file_name or 'Document Preview',
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user