Files
Odoo-Modules/fusion_plating/fusion_plating_quality/models/res_company.py
gsinghpal 21da526aa7 feat(plating): Sub 4 — Contract Review (optional, QA-005 1:1 PDF)
Per-part contract review record (fp.contract.review) gated by a
customer-level toggle, signed in two sections (QA Assistant → QA
Manager), settings-based signer rosters (no new res.groups), banner on
the part form that auto-dismisses once the first MO for the part hits
confirmed. QA-005 Rev. 0 paper form reproduced 1:1 in a QWeb PDF.

Never blocks MO/SO/WO — review is purely an audit artefact.

Smoke test run on entech: 12 assertions pass including the 25-cell
risk matrix parity with the paper form and 22 KB PDF render.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 21:43:06 -04:00

52 lines
1.9 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 ResCompany(models.Model):
_inherit = 'res.company'
# Contract Review signer rosters. Company-scoped so multi-tenant
# Odoo deployments keep their own QA team isolated. Managed from
# Settings → Fusion Plating → Contract Review. Stored here (not
# as groups) so granting the right to sign a Contract Review does
# not cascade any other permission elsewhere in Odoo.
x_fc_qa_assistant_user_ids = fields.Many2many(
'res.users',
'res_company_qa_assistant_rel',
'company_id',
'user_id',
string='QA Assistant Signers',
domain=[('share', '=', False)],
help='Users authorised to sign Section 2.0 (Planning / Production '
'Review) on a Contract Review. Plating Managers can sign '
'regardless of this list.',
)
x_fc_qa_manager_user_ids = fields.Many2many(
'res.users',
'res_company_qa_manager_rel',
'company_id',
'user_id',
string='QA Manager Signers',
domain=[('share', '=', False)],
help='Users authorised to sign Section 3.0 (Quality Review) on a '
'Contract Review. Plating Managers can sign regardless of '
'this list.',
)
def _fp_get_qa_signers(self, section):
"""Return effective signer roster for Section 2.0 or 3.0.
Central helper so Sub 6 (per-customer / contact profiles) can
layer overrides without touching the sign action call sites.
"""
self.ensure_one()
if section == 20:
return self.x_fc_qa_assistant_user_ids
if section == 30:
return self.x_fc_qa_manager_user_ids
return self.env['res.users']