folder rename
This commit is contained in:
61
fusion_plating/fusion_plating_nuclear/models/fp_ncr.py
Normal file
61
fusion_plating/fusion_plating_nuclear/models/fp_ncr.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# -*- 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 FpNcr(models.Model):
|
||||
"""Extend the quality NCR with nuclear flags and 10 CFR 21 hook.
|
||||
|
||||
When an NCR is opened against a nuclear job, quality needs to
|
||||
decide within the 10 CFR Part 21 evaluation clock whether the
|
||||
non-conformance rises to the level of a substantial safety hazard.
|
||||
The `x_fc_cfr21_report_id` link lets an NCR spawn a 10 CFR 21
|
||||
record and track the outcome without duplicating the narrative.
|
||||
"""
|
||||
_inherit = 'fusion.plating.ncr'
|
||||
|
||||
x_fc_is_nuclear = fields.Boolean(
|
||||
string='Nuclear Job',
|
||||
tracking=True,
|
||||
help='Tick when the non-conformance occurred on a nuclear job. '
|
||||
'This flags the NCR for 10 CFR Part 21 evaluation.',
|
||||
)
|
||||
x_fc_n299_level_id = fields.Many2one(
|
||||
'fusion.plating.n299.level',
|
||||
string='CSA N299 Level',
|
||||
tracking=True,
|
||||
)
|
||||
x_fc_cfr21_evaluated = fields.Boolean(
|
||||
string='10 CFR 21 Evaluated',
|
||||
tracking=True,
|
||||
)
|
||||
x_fc_cfr21_report_id = fields.Many2one(
|
||||
'fusion.plating.10cfr21.report',
|
||||
string='10 CFR 21 Report',
|
||||
tracking=True,
|
||||
)
|
||||
|
||||
def action_open_cfr21_report(self):
|
||||
"""Create or open the linked 10 CFR Part 21 evaluation record."""
|
||||
self.ensure_one()
|
||||
if not self.x_fc_cfr21_report_id:
|
||||
report = self.env['fusion.plating.10cfr21.report'].create({
|
||||
'discovery_date': fields.Date.context_today(self),
|
||||
'part_description': self.part_ref or '',
|
||||
'defect_description': self.description or '',
|
||||
'ncr_id': self.id,
|
||||
})
|
||||
self.write({
|
||||
'x_fc_cfr21_report_id': report.id,
|
||||
'x_fc_cfr21_evaluated': True,
|
||||
})
|
||||
return {
|
||||
'name': '10 CFR 21 Report',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'fusion.plating.10cfr21.report',
|
||||
'view_mode': 'form',
|
||||
'res_id': self.x_fc_cfr21_report_id.id,
|
||||
}
|
||||
Reference in New Issue
Block a user