changes
This commit is contained in:
109
fusion-plating/fusion_plating_cgp/models/fp_cgp_visitor.py
Normal file
109
fusion-plating/fusion_plating_cgp/models/fp_cgp_visitor.py
Normal file
@@ -0,0 +1,109 @@
|
||||
# -*- 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
|
||||
|
||||
|
||||
class FpCgpVisitor(models.Model):
|
||||
"""Visitor log entry under the Controlled Goods Program.
|
||||
|
||||
Every visitor to a site that handles controlled goods must be
|
||||
logged, approved by an Authorized Individual, and escorted if
|
||||
they do not have a PSA on file. Foreign nationals can only access
|
||||
controlled goods under very specific conditions.
|
||||
"""
|
||||
_name = 'fusion.plating.cgp.visitor'
|
||||
_description = 'Fusion Plating — CGP Visitor'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'visit_date desc, id desc'
|
||||
|
||||
name = fields.Char(
|
||||
string='Visitor Name',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
company_represented = fields.Char(
|
||||
string='Company Represented',
|
||||
tracking=True,
|
||||
)
|
||||
visit_date = fields.Datetime(
|
||||
string='Visit Start',
|
||||
required=True,
|
||||
default=lambda self: fields.Datetime.now(),
|
||||
tracking=True,
|
||||
)
|
||||
visit_end = fields.Datetime(
|
||||
string='Visit End',
|
||||
tracking=True,
|
||||
)
|
||||
purpose = fields.Text(
|
||||
string='Purpose',
|
||||
tracking=True,
|
||||
)
|
||||
host_id = fields.Many2one(
|
||||
'hr.employee',
|
||||
string='Host',
|
||||
tracking=True,
|
||||
)
|
||||
is_canadian_citizen = fields.Boolean(
|
||||
string='Canadian Citizen',
|
||||
tracking=True,
|
||||
)
|
||||
visitor_psa_on_file = fields.Boolean(
|
||||
string='PSA On File',
|
||||
tracking=True,
|
||||
help='The visitor has a valid Personnel Security Assessment '
|
||||
'on file with PSPC or an approved foreign equivalent.',
|
||||
)
|
||||
approved_by_id = fields.Many2one(
|
||||
'res.users',
|
||||
string='Approved By',
|
||||
tracking=True,
|
||||
help='Must be an Authorized Individual.',
|
||||
)
|
||||
escort_required = fields.Boolean(
|
||||
string='Escort Required',
|
||||
default=True,
|
||||
tracking=True,
|
||||
)
|
||||
accessed_controlled_area = fields.Boolean(
|
||||
string='Accessed Controlled Area',
|
||||
tracking=True,
|
||||
)
|
||||
state = fields.Selection(
|
||||
[
|
||||
('scheduled', 'Scheduled'),
|
||||
('checked_in', 'Checked In'),
|
||||
('checked_out', 'Checked Out'),
|
||||
('denied', 'Denied'),
|
||||
('cancelled', 'Cancelled'),
|
||||
],
|
||||
string='Status',
|
||||
default='scheduled',
|
||||
required=True,
|
||||
tracking=True,
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
'res.company',
|
||||
string='Company',
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
notes = fields.Html(string='Notes')
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
def action_check_in(self):
|
||||
self.write({'state': 'checked_in'})
|
||||
|
||||
def action_check_out(self):
|
||||
self.write({
|
||||
'state': 'checked_out',
|
||||
'visit_end': fields.Datetime.now(),
|
||||
})
|
||||
|
||||
def action_deny(self):
|
||||
self.write({'state': 'denied'})
|
||||
|
||||
def action_cancel(self):
|
||||
self.write({'state': 'cancelled'})
|
||||
Reference in New Issue
Block a user