Files
Odoo-Modules/fusion_plating/fusion_plating_certificates/models/res_partner.py
gsinghpal 7d3b8f132a fix(sub12c+): close 3 known gaps — rack travel ticket, cert statement, CoC actuals
Gap 1 — Rack Travel Ticket PDF (Sub 12b's Save+Print 404):
  + report_fp_rack_travel.xml in fusion_plating_reports — A5 landscape
    single page, big rack name, Code 128 of FP-RACK:<name>, tag chips,
    contained part-batches table.
  + ir.actions.report bound to fusion.plating.rack so it appears in
    the rack form's Print menu too.
  + Sub 12b's rack_parts_dialog.js Save+Print URL fixed to use the
    standard /report/pdf/<xmlid>/<id> route.

Gap 2 — Per-customer cert statement:
  + res.company.x_fc_default_cert_statement (company-level fallback).
  + res.partner.x_fc_cert_statement (per-customer override).
  + Surfaced on the partner form under the existing Cert + Document
    Routing block.
  + Chronological CoC body resolves: customer override → company
    default → hardcoded AS9100/ISO 9001 boilerplate. Three-tier
    fallback so existing certs without overrides keep working.

Gap 3 — Chronological CoC 'Actual' column:
  + Build a captured_values_by_input dict from the move's
    transition_input_value_ids (Sub 12b captures these on every
    Move Parts commit).
  + Render typed Actual: text → as-is, number → with target unit,
    boolean → PASS/FAIL, date → formatted, attachment → '[Attachment]'
    placeholder.
  + Falls back to prompts from the destination step's step_input list
    when no values were captured (still useful as audit-of-what-was-
    asked even if blank).

Version bumps:
  fusion_plating → 19.0.10.3.0
  fusion_plating_reports → 19.0.10.1.0
  fusion_plating_certificates → 19.0.5.3.0

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

101 lines
4.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 ResPartner(models.Model):
"""Per-customer preferences for what quality documents are generated
and emailed when a job ships.
Some aerospace customers insist on a full CoC + thickness report;
others just want the CoC; some repeat commercial accounts want
neither (the PO says "no paperwork required"). Rather than hard-code
the shop's policy, each customer controls their own.
"""
_inherit = 'res.partner'
x_fc_send_coc = fields.Boolean(
string='Send Certificate of Conformance',
default=True, tracking=True,
help='When shipping, auto-generate and email a CoC to this customer.',
)
x_fc_send_thickness_report = fields.Boolean(
string='Send Thickness Report',
default=True, tracking=True,
help='When shipping, auto-generate and email a thickness report '
'with the Fischerscope readings for this job.',
)
x_fc_send_packing_slip = fields.Boolean(
string='Send Packing Slip',
default=True, tracking=True,
help='Attach the packing slip PDF to the shipping confirmation email.',
)
x_fc_send_bol = fields.Boolean(
string='Send Bill of Lading',
default=False, tracking=True,
help='Attach the BoL PDF to the shipping confirmation email. '
'Usually only for customers that invoice freight separately.',
)
x_fc_strict_thickness_required = fields.Boolean(
string='Require Thickness Readings on CoC',
default=False, tracking=True,
help='Aerospace / Nadcap customers expect every CoC to carry '
'actual Fischerscope readings (not just "meets spec"). When '
'this is on, action_issue() blocks until at least one '
'thickness reading has been logged for the MO. Leave off '
'for commercial customers.',
)
# ---- Sub 6 — Per-contact communication routing -----------------------
# These five flags live on CHILD contacts under a company partner.
# When every contact under a company leaves them blank, the resolver
# falls back to the company's own `email` — matching the pre-Sub-6
# behaviour exactly. Admins opt in to per-contact routing by ticking
# the relevant flag on each contact row.
x_fc_receives_certs = fields.Boolean(
string='Receives Certificates',
default=False, tracking=True,
help='This contact receives CoC PDFs, thickness reports, and '
'other quality documents when a job ships.',
)
x_fc_receives_qc = fields.Boolean(
string='Receives QC Alerts',
default=False, tracking=True,
help='This contact receives NCR, CAPA, quality-hold, and contract-'
'review notifications.',
)
x_fc_receives_quotes_so = fields.Boolean(
string='Receives Quotes & SOs',
default=False, tracking=True,
help='This contact receives quote sends, sale order acknowledgements, '
'and order confirmations.',
)
x_fc_receives_invoices = fields.Boolean(
string='Receives Invoices',
default=False, tracking=True,
help='This contact receives invoices, payment receipts, and '
'dunning communications.',
)
x_fc_is_global_contact = fields.Boolean(
string='Global Contact',
default=False, tracking=True,
help='Firehose. When set, this contact receives every outbound '
'stream regardless of the per-stream flags above. Typical '
'use: a primary account-manager contact who wants full '
'visibility into everything the shop sends out.',
)
# ---- Sub 12c+ — Per-customer cert statement override ----------------
x_fc_cert_statement = fields.Text(
string='Cert Statement Override',
help='Override boilerplate text printed in the Certificate of '
'Conformance "Certification Statement" block. When blank, '
'falls back to the company default (res.company.'
'x_fc_default_cert_statement) and finally to a hardcoded '
'AS9100/ISO 9001 boilerplate. Useful for aerospace customers '
'who require specific NIST or DFARS language.',
)