Files
Odoo-Modules/fusion_plating/fusion_plating_jobs/views/fp_certificate_views.xml
gsinghpal 1314f4581d changes
2026-05-21 03:37:25 -04:00

202 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- ============================================================ -->
<!-- S19 — Surface Fischerscope thickness PDF on the cert form -->
<!-- ============================================================ -->
<!-- Without this extension the operator has no way to know, -->
<!-- before clicking Issue, whether the QC's Fischerscope PDF -->
<!-- will be appended to the CoC. After Issue, no indicator that -->
<!-- the merged PDF actually contains it. This extension fixes -->
<!-- both gaps with a banner + smart button + clickable file. -->
<record id="fp_certificate_view_form_jobs"
model="ir.ui.view">
<field name="name">fp.certificate.form.inherit.jobs</field>
<field name="model">fp.certificate</field>
<field name="inherit_id"
ref="fusion_plating_certificates.fp_certificate_view_form"/>
<field name="arch" type="xml">
<!-- 1. Smart button: linked Plating Job, and a separate -->
<!-- smart button for the Fischerscope-source QC. -->
<xpath expr="//div[@name='button_box']" position="inside">
<button name="action_open_job"
type="object"
class="oe_stat_button"
icon="fa-cogs"
invisible="not x_fc_job_id">
<field name="x_fc_job_id" widget="statinfo"
string="Work Order"/>
</button>
<button name="action_view_thickness_qc"
type="object"
class="oe_stat_button"
icon="fa-microscope"
invisible="not x_fc_thickness_qc_id">
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">
<field name="x_fc_thickness_status" widget="badge"
decoration-info="x_fc_thickness_status == 'pending'"
decoration-success="x_fc_thickness_status == 'merged'"/>
</span>
<span class="o_stat_text">Fischerscope</span>
</div>
</button>
</xpath>
<!-- 2. Banner row above the title — explicit, can't miss. -->
<!-- Three states with distinct alert classes. -->
<xpath expr="//sheet/div[@class='oe_title']" position="before">
<div class="alert alert-info" role="alert"
invisible="x_fc_thickness_status != 'pending'">
<i class="fa fa-info-circle" title="Info"
aria-label="Info"/>
<strong> Fischerscope thickness PDF is on file.</strong>
It will be automatically appended as page&#160;2 of
the CoC when you click <strong>Issue</strong>.
</div>
<div class="alert alert-success" role="alert"
invisible="x_fc_thickness_status != 'merged'">
<i class="fa fa-check-circle" title="Merged"
aria-label="Merged"/>
<strong> Fischerscope thickness report merged.</strong>
The issued CoC PDF includes the Fischerscope report
as page&#160;2 — open the Certificate&#160;PDF tab to verify.
</div>
<div class="alert alert-warning" role="alert"
invisible="state != 'draft' or x_fc_thickness_status != 'none' or not partner_id"
style="margin-top:0;">
<i class="fa fa-exclamation-triangle" title="Warning"
aria-label="Warning"/>
<strong> No Fischerscope PDF available.</strong>
Drop the PDF into the <em>Thickness Report
(Fischerscope)</em> tab below, or upload it on the
linked QC check, before issuing. Thickness Report
certs cannot issue without thickness data.
</div>
</xpath>
<!-- 3. Thickness Report tab — single place to see/edit
every Fischerscope-related field on the cert.
Reorganized 2026-05-21:
* Status + linked QC at the top (read-only context)
* XDAL 600 metadata (operator/product/etc.) editable
so manager can correct OCR mistakes
* Microscope image preview (auto-extracted from RTF
or manually uploaded — either way editable here)
* Source files (PDF / non-PDF evidence / source name)
* Upload wizard button + help text -->
<xpath expr="//notebook/page[@name='pdf']" position="after">
<page string="Thickness Report (Fischerscope)"
name="thickness_pdf">
<!-- Status + QC link (read-only context) -->
<group>
<field name="x_fc_thickness_status" widget="badge"
readonly="1"
decoration-muted="x_fc_thickness_status == 'none'"
decoration-info="x_fc_thickness_status == 'pending'"
decoration-success="x_fc_thickness_status == 'merged'"/>
<field name="x_fc_thickness_qc_id" readonly="1"
invisible="not x_fc_thickness_qc_id"/>
</group>
<!-- Hints rotate by state -->
<div class="text-muted"
invisible="x_fc_thickness_status != 'none'">
<p>
No Fischerscope thickness data has been
uploaded yet. Click <strong>Upload Thickness
Report</strong> below to drop a `.doc` / `.docx`
/ `.rtf` / `.pdf` file straight from the
XDAL&#160;600. The wizard parses readings +
metadata and fills out the fields on this tab.
</p>
</div>
<div class="text-muted"
invisible="x_fc_thickness_status != 'pending'">
<p>
<i class="fa fa-arrow-up"/>
Click <strong>Issue</strong> in the header to
merge the Fischerscope PDF as page&#160;2 of
the CoC. Readings will render inline in the
body of the cert either way.
</p>
</div>
<!-- Upload wizard CTA -->
<div style="margin: 8px 0;">
<button name="%(fusion_plating_certificates.action_fp_thickness_upload_wizard)d"
type="action"
class="btn-primary"
string="Upload Thickness Report"
context="{'default_certificate_id': id}"
invisible="state != 'draft'"/>
</div>
<separator string="XDAL 600 Measurement Context"/>
<p class="text-muted small">
These values are pulled from the uploaded file
and printed on the CoC's thickness section. Edit
any field here to override what the parser saw.
</p>
<group>
<group>
<field name="x_fc_thickness_equipment"
placeholder="Fischerscope XDAL 600"/>
<field name="x_fc_thickness_operator"
placeholder="Operator initials / name"/>
<field name="x_fc_thickness_datetime"/>
<field name="x_fc_thickness_measuring_time_sec"/>
</group>
<group>
<field name="x_fc_thickness_product"
placeholder="e.g. 2805031 / NiP/Al-alloys 2805030"/>
<field name="x_fc_thickness_application"
placeholder="e.g. 16 / NiP/Al-alloys"/>
<field name="x_fc_thickness_directory"
placeholder="XDAL save directory"/>
<field name="x_fc_thickness_source_filename"
readonly="1"/>
</group>
</group>
<separator string="Microscope Image"/>
<p class="text-muted small">
Auto-extracted from RTF uploads (via libwmf) or
manually uploaded via the wizard. Drop a new
PNG/JPEG here to override.
</p>
<group>
<field name="x_fc_thickness_image_id"
options="{'no_create': True}"/>
</group>
<separator string="Source Files"/>
<group>
<group string="Fischerscope PDF"
invisible="not x_fc_local_thickness_pdf">
<field name="x_fc_local_thickness_pdf"
filename="x_fc_local_thickness_pdf_filename"/>
<field name="x_fc_local_thickness_pdf_filename"
invisible="1"/>
</group>
<group string="Non-PDF Evidence (RTF/DOCX)"
invisible="not x_fc_local_thickness_evidence_id">
<field name="x_fc_local_thickness_evidence_id"
options="{'no_create': True}"/>
</group>
<group string="QC-side Fischerscope PDF"
invisible="not x_fc_thickness_pdf_id">
<field name="x_fc_thickness_pdf_id" readonly="1"
widget="many2one_binary"/>
</group>
</group>
</page>
</xpath>
</field>
</record>
</odoo>