Files
Odoo-Modules/fusion-plating/fusion_plating_notifications/models/fp_notification_log.py
2026-04-12 20:09:07 -04:00

40 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
from odoo import fields, models
TRIGGER_EVENTS = [
('so_confirmed', 'Order Confirmed'),
('parts_received', 'Parts Received'),
('mo_complete', 'Manufacturing Complete'),
('shipment', 'Shipment (Carrier)'),
('delivery', 'Delivery (Local)'),
('invoice_posted', 'Invoice Posted'),
('deposit_created', 'Deposit Required'),
]
class FpNotificationLog(models.Model):
"""Audit trail for sent notifications."""
_name = 'fp.notification.log'
_description = 'Fusion Plating — Notification Log'
_order = 'sent_date desc, id desc'
template_id = fields.Many2one(
'fp.notification.template', string='Template', ondelete='set null',
)
trigger_event = fields.Selection(TRIGGER_EVENTS, string='Trigger Event')
sale_order_id = fields.Many2one('sale.order', string='Sale Order')
partner_id = fields.Many2one('res.partner', string='Customer')
sent_date = fields.Datetime(string='Sent Date', default=fields.Datetime.now)
recipient_email = fields.Char(string='Recipient Email')
attachment_names = fields.Text(string='Attachments')
status = fields.Selection(
[('sent', 'Sent'), ('failed', 'Failed')],
string='Status', default='sent',
)
error_message = fields.Text(string='Error Message')
mail_mail_id = fields.Many2one('mail.mail', string='Mail Record')