81 lines
2.3 KiB
Python
81 lines
2.3 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
|
|
|
|
|
|
class FpJhsc(models.Model):
|
|
"""A Joint Health and Safety Committee.
|
|
|
|
Most Canadian jurisdictions require workplaces above a certain employee
|
|
count to maintain a Joint Health and Safety Committee (JHSC) with at
|
|
least one worker representative and one management representative.
|
|
The committee meets on a regular cadence to review hazards, incidents,
|
|
and proposed improvements.
|
|
|
|
A site can have one or more committees (e.g. when multiple buildings
|
|
or shifts each maintain their own). Membership is tracked as overall
|
|
members plus the specific worker and management representative subsets.
|
|
"""
|
|
_name = 'fusion.plating.jhsc'
|
|
_description = 'Fusion Plating — JHSC'
|
|
_inherit = ['mail.thread', 'mail.activity.mixin']
|
|
_order = 'name'
|
|
|
|
name = fields.Char(
|
|
string='Committee',
|
|
required=True,
|
|
tracking=True,
|
|
)
|
|
facility_id = fields.Many2one(
|
|
'fusion.plating.facility',
|
|
string='Facility',
|
|
tracking=True,
|
|
)
|
|
company_id = fields.Many2one(
|
|
'res.company',
|
|
string='Company',
|
|
default=lambda self: self.env.company,
|
|
)
|
|
active = fields.Boolean(default=True)
|
|
|
|
member_ids = fields.Many2many(
|
|
'hr.employee',
|
|
'fp_jhsc_member_rel',
|
|
'jhsc_id',
|
|
'employee_id',
|
|
string='Members',
|
|
)
|
|
worker_rep_ids = fields.Many2many(
|
|
'hr.employee',
|
|
'fp_jhsc_worker_rep_rel',
|
|
'jhsc_id',
|
|
'employee_id',
|
|
string='Worker Representatives',
|
|
)
|
|
mgmt_rep_ids = fields.Many2many(
|
|
'hr.employee',
|
|
'fp_jhsc_mgmt_rep_rel',
|
|
'jhsc_id',
|
|
'employee_id',
|
|
string='Management Representatives',
|
|
)
|
|
meeting_ids = fields.One2many(
|
|
'fusion.plating.jhsc.meeting',
|
|
'jhsc_id',
|
|
string='Meetings',
|
|
)
|
|
member_count = fields.Integer(
|
|
compute='_compute_counts',
|
|
)
|
|
meeting_count = fields.Integer(
|
|
compute='_compute_counts',
|
|
)
|
|
|
|
def _compute_counts(self):
|
|
for rec in self:
|
|
rec.member_count = len(rec.member_ids)
|
|
rec.meeting_count = len(rec.meeting_ids)
|