36 lines
2.0 KiB
Python
36 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class FpFacility(models.Model):
|
|
_inherit = 'fusion.plating.facility'
|
|
|
|
x_fp_eca_number = fields.Char(string='ECA / Approval Number')
|
|
x_fp_sewer_permit_number = fields.Char(string='Sewer Permit Number')
|
|
x_fp_waste_generator_number = fields.Char(string='Waste Generator Number')
|
|
x_fp_compliance_notes = fields.Html(string='Compliance Notes')
|
|
|
|
permit_ids = fields.One2many('fusion.plating.permit', 'facility_id', string='Permits')
|
|
waste_stream_ids = fields.One2many('fusion.plating.waste.stream', 'facility_id', string='Waste Streams')
|
|
discharge_sample_ids = fields.One2many('fusion.plating.discharge.sample', 'facility_id', string='Discharge Samples')
|
|
compliance_event_ids = fields.One2many('fusion.plating.compliance.event', 'facility_id', string='Compliance Events')
|
|
spill_register_ids = fields.One2many('fusion.plating.spill.register', 'facility_id', string='Spill Register')
|
|
|
|
permit_count = fields.Integer(string='Permits', compute='_compute_compliance_counts')
|
|
compliance_event_count = fields.Integer(string='Compliance Events', compute='_compute_compliance_counts')
|
|
waste_stream_count = fields.Integer(string='Waste Streams', compute='_compute_compliance_counts')
|
|
discharge_sample_count = fields.Integer(string='Samples', compute='_compute_compliance_counts')
|
|
spill_count = fields.Integer(string='Spills', compute='_compute_compliance_counts')
|
|
|
|
@api.depends('permit_ids', 'compliance_event_ids', 'waste_stream_ids',
|
|
'discharge_sample_ids', 'spill_register_ids')
|
|
def _compute_compliance_counts(self):
|
|
for rec in self:
|
|
rec.permit_count = len(rec.permit_ids)
|
|
rec.compliance_event_count = len(rec.compliance_event_ids)
|
|
rec.waste_stream_count = len(rec.waste_stream_ids)
|
|
rec.discharge_sample_count = len(rec.discharge_sample_ids)
|
|
rec.spill_count = len(rec.spill_register_ids)
|