fix(configurator): Part cell row 1 shows part# / rev separately via CSS overlay
Root cause: my @api.depends_context('fp_express_part_picker') decorator
on _compute_display_name was not honored by Odoo. Verified via odoo
shell — display_name returns the full 'PART (Rev X) — Name' regardless
of context. Reason: display_name is defined on the base Model class
and Odoo registers the field metadata (incl. _depends_context) when
the field is FIRST declared. Subclass redefinitions of the compute
method don't update _depends_context after the fact.
Workaround: don't rely on display_name context override. Instead,
overlay a custom span on top of the Many2OneField that shows JUST
the part_number_display value. CSS overlay uses:
- position: absolute / inset: 0
- background: $xpr-card (matches list row background)
- z-index: 2 over the picker
- pointer-events: none so clicks pass through to the picker
When the picker is focused (:focus-within parent), the overlay
hides so the user sees the autocomplete input value as they type.
When not focused, the overlay covers display_name with just the
part number.
Row 1 now reads 'ENG-1042 / B' — picker on the left (showing only
part_number_display), separator, revision on the right. Matches the
mockup pixel layout the user requested.
This commit is contained in:
@@ -11,9 +11,20 @@
|
||||
-->
|
||||
<t t-name="fusion_plating_configurator.FpExpressPartCell">
|
||||
<div class="o_fp_xpr_part_cell">
|
||||
<!-- Row 1 — Part picker -->
|
||||
<!-- Row 1 — Part picker (left, with part-number overlay) + / + Revision (right)
|
||||
The overlay shows JUST the part_number_display when not focused;
|
||||
on focus, the overlay hides so the user sees the autocomplete input. -->
|
||||
<div class="o_fp_xpr_part_row o_fp_xpr_part_id">
|
||||
<Many2OneField t-props="props"/>
|
||||
<div class="o_fp_xpr_part_picker_wrap">
|
||||
<Many2OneField t-props="props"/>
|
||||
<span t-if="hasPart"
|
||||
class="o_fp_xpr_part_num_overlay"
|
||||
t-esc="partNumber"/>
|
||||
</div>
|
||||
<span class="o_fp_xpr_part_sep">/</span>
|
||||
<span class="o_fp_xpr_part_rev"
|
||||
t-att-class="{ 'o_fp_xpr_part_rev_empty': !partRev }"
|
||||
t-esc="partRev or 'rev'"/>
|
||||
</div>
|
||||
<!-- Row 2 — Editable part description (saves to part.name) -->
|
||||
<div class="o_fp_xpr_part_row o_fp_xpr_part_name">
|
||||
|
||||
Reference in New Issue
Block a user