# -*- 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 api, fields, models class FpAs9100Clause(models.Model): """AS9100 Rev D clause catalog. A flat catalogue of clauses and sub-clauses from the AS9100 Rev D standard, plus related standards (ISO 9001:2015, etc.). Used by customer specifications and audit findings to pin a requirement to the specific paragraph of the standard it satisfies. """ _name = 'fusion.plating.as9100.clause' _description = 'Fusion Plating — AS9100 Clause' _order = 'standard, code, id' _parent_store = True _rec_name = 'display_name' name = fields.Char( string='Name', required=True, translate=True, ) display_name = fields.Char( compute='_compute_display_name', store=True, ) code = fields.Char( string='Clause Code', required=True, help='Clause reference number, e.g. 8.1.2.', ) parent_id = fields.Many2one( 'fusion.plating.as9100.clause', string='Parent Clause', ondelete='cascade', index=True, ) parent_path = fields.Char(index=True, unaccent=False) child_ids = fields.One2many( 'fusion.plating.as9100.clause', 'parent_id', string='Sub-clauses', ) description = fields.Html( string='Description', translate=True, ) standard = fields.Selection( [ ('as9100d', 'AS9100 Rev D'), ('iso9001_2015', 'ISO 9001:2015'), ('other', 'Other'), ], string='Standard', default='as9100d', required=True, ) category = fields.Selection( [ ('leadership', 'Leadership'), ('planning', 'Planning'), ('support', 'Support'), ('operation', 'Operation'), ('performance', 'Performance Evaluation'), ('improvement', 'Improvement'), ], string='Category', ) notes = fields.Html( string='Notes', translate=True, ) active = fields.Boolean(default=True) _sql_constraints = [ ( 'fp_as9100_clause_code_std_uniq', 'unique(code, standard)', 'A clause code must be unique per standard.', ), ] @api.depends('code', 'name') def _compute_display_name(self): for rec in self: parts = [] if rec.code: parts.append(rec.code) if rec.name: parts.append(rec.name) rec.display_name = ' — '.join(parts) if parts else ''