fix(certs): auto-edit first row in Issue Certs wizard so upload is visible

Previous attempt (e5928b96) used CSS to force the binary widget's
"Upload your file" button visible in display mode. Problem: it
rendered a non-clickable stub in every row, then DUPLICATED when
the operator clicked into edit mode (two upload links stacked).

Drop the SCSS hack entirely. Replace with a custom form-view
controller that auto-edits the first incomplete row on mount.
When the wizard opens, the JS:

  1. Scopes itself via the form's o_fp_cert_issue_wizard_form class
     (no-ops on every other form view in the system).
  2. Finds rows where the is_ready toggle is False.
  3. Clicks the fischer_file cell of the first such row.
  4. The row enters edit mode → Odoo's native binary widget renders
     its upload button → operator drops the file → onchange fires
     → readings parse.

Wired via js_class="fp_cert_issue_wizard_form" on the form root.
Banner copy updated to "Click a row, then click Upload your file in
the Fischerscope column" so even if the auto-edit fails for some
DOM reason, the operator knows the click path.

Module: fusion_plating_jobs 19.0.10.16.1 → 19.0.10.16.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-20 09:15:27 -04:00
parent e5928b965f
commit 2e4d957a47
4 changed files with 97 additions and 63 deletions

View File

@@ -1,56 +0,0 @@
// =============================================================
// Fusion Plating — Issue Certs wizard styling
// =============================================================
//
// 2026-05-20: force the Fischerscope binary-field upload button to
// be visible in display mode (not just when the row is being edited).
// Odoo's default `widget="binary"` only shows "↑ Upload your file"
// when the row is in edit mode — operators couldn't see what to
// click in the wizard list and reported it as a missing affordance.
//
// Targets ONLY the fischer_file column in this wizard so it doesn't
// affect binary fields elsewhere in the system.
.o_form_view {
.o_field_one2many[name="line_ids"] {
// List renderer — affect every binary cell that backs
// fischer_file. We can't always target by name attribute
// (Odoo 19 doesn't put `name=` on the <td>), so use the
// child field widget binding.
.o_list_renderer .o_data_cell {
.o_field_widget.o_field_binary {
// Always show the upload button, even on rows that
// aren't currently being edited. The default theme
// hides it on non-selected rows.
.o_select_file_button {
display: inline-flex !important;
align-items: center;
gap: .25rem;
color: var(--primary, #5d83a4);
text-decoration: underline dotted;
background: transparent;
border: 0;
padding: .15rem .35rem;
cursor: pointer;
font-size: .85rem;
// Add an upward-arrow + label so it reads as an
// action even if Odoo's stock label text changes.
&::before {
content: "\f093"; // fa-upload (FontAwesome 4)
font-family: "FontAwesome";
margin-right: .25rem;
}
&:hover {
color: var(--primary-hover, #4a6f8e);
background: rgba(93, 131, 164, .08);
}
}
// Empty cell shouldn't collapse to 0 height — give it
// a clickable target area.
min-height: 28px;
display: flex;
align-items: center;
}
}
}
}