feat(certificates): per-customer document preferences (CHUNK 1/4)
Customers can now pick which shipping-time documents they actually want instead of the shop remembering it per account. Four booleans on res.partner (only shown on companies, not contacts): x_fc_send_coc (default True) Certificate of Conformance x_fc_send_thickness_report (default True) Thickness readings x_fc_send_packing_slip (default True) Packing slip PDF x_fc_send_bol (default False) Bill of Lading Surfaced in a "Plating Documents" page on the customer form. Two downstream gates: 1. fp.notification.template._collect_attachments() now reads the flags when attaching CoC / thickness / packing / BoL PDFs to the shipping confirmation email. Flags missing on the partner (e.g. legacy customers) fall back to the original defaults so nothing regresses. 2. mrp.production.button_mark_done() only auto-creates the quality documents the customer wants. A customer that unchecks both CoC and thickness gets zero certs auto-generated — shop can still create them manually if needed. Note: today a standalone thickness-only report template doesn't exist, so when a customer asks for thickness only (CoC off, thickness on) the dispatcher still attaches the CoC PDF (which carries thickness data) but with CoC creation gated off. A dedicated thickness-only template is a follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ Includes Fischerscope thickness measurement data capture.
|
||||
'data/fp_certificate_sequence_data.xml',
|
||||
'views/res_config_settings_views.xml',
|
||||
'views/fp_certificate_views.xml',
|
||||
'views/res_partner_views.xml',
|
||||
'views/fp_certificates_menu.xml',
|
||||
],
|
||||
'installable': True,
|
||||
|
||||
@@ -6,3 +6,4 @@
|
||||
from . import fp_thickness_reading
|
||||
from . import fp_certificate
|
||||
from . import res_config_settings
|
||||
from . import res_partner
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# -*- 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.',
|
||||
)
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2026 Nexa Systems Inc.
|
||||
License OPL-1 (Odoo Proprietary License v1.0)
|
||||
Part of the Fusion Plating product family.
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
<record id="view_partner_form_fp_document_prefs" model="ir.ui.view">
|
||||
<field name="name">res.partner.form.fp.document.prefs</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="Plating Documents"
|
||||
name="fp_document_prefs"
|
||||
invisible="is_company != True">
|
||||
<group string="Documents to Send on Shipment"
|
||||
name="fp_document_prefs_group">
|
||||
<p class="text-muted" colspan="2">
|
||||
Control which quality documents are auto-generated and
|
||||
emailed to this customer when a job ships. Matches the
|
||||
customer's PO requirements so the shop doesn't have to
|
||||
remember per-account preferences.
|
||||
</p>
|
||||
<group>
|
||||
<field name="x_fc_send_coc" widget="boolean_toggle"/>
|
||||
<field name="x_fc_send_thickness_report" widget="boolean_toggle"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="x_fc_send_packing_slip" widget="boolean_toggle"/>
|
||||
<field name="x_fc_send_bol" widget="boolean_toggle"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user