Initial commit
This commit is contained in:
37
fusion_faxes/models/res_partner.py
Normal file
37
fusion_faxes/models/res_partner.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
x_ff_fax_number = fields.Char(string='Fax Number')
|
||||
x_ff_fax_ids = fields.One2many(
|
||||
'fusion.fax',
|
||||
'partner_id',
|
||||
string='Fax History',
|
||||
)
|
||||
x_ff_fax_count = fields.Integer(
|
||||
string='Fax Count',
|
||||
compute='_compute_fax_count',
|
||||
)
|
||||
|
||||
@api.depends('x_ff_fax_ids')
|
||||
def _compute_fax_count(self):
|
||||
for partner in self:
|
||||
partner.x_ff_fax_count = len(partner.x_ff_fax_ids)
|
||||
|
||||
def action_view_faxes(self):
|
||||
"""Open fax history for this contact."""
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Fax History',
|
||||
'res_model': 'fusion.fax',
|
||||
'view_mode': 'list,form',
|
||||
'domain': [('partner_id', '=', self.id)],
|
||||
'context': {'default_partner_id': self.id},
|
||||
}
|
||||
Reference in New Issue
Block a user