feat(configurator): auto-load latest part description version on order entry

Wizard line (direct + express) and SO line now pre-fill BOTH internal +
customer-facing from the part's latest version (fallback to
default_specification_text), without clobbering typed text.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-29 19:57:16 -04:00
parent da7ec59474
commit 855b160752
3 changed files with 34 additions and 6 deletions

View File

@@ -629,12 +629,16 @@ class FpDirectOrderLine(models.Model):
if bake_default:
rec.bake_instructions = bake_default
# ---- Express line_description (Specification) ----
# Only seed if currently empty (don't clobber operator-typed text).
if not rec.line_description:
spec_default = getattr(part, 'default_specification_text', None)
if spec_default:
rec.line_description = spec_default
# ---- Description history auto-load (spec 2026-05-29) ----
# Latest per-part version wins; _fp_resolve_line_descriptions
# falls back to default_specification_text (customer-facing only)
# for parts with no version yet. Loads BOTH fields; never
# clobbers text the operator already typed.
descs = part._fp_resolve_line_descriptions()
if not rec.line_description and descs['customer_facing']:
rec.line_description = descs['customer_facing']
if not rec.internal_description and descs['internal']:
rec.internal_description = descs['internal']
# ---- Express masking_enabled (always re-seed from part default) ----
# Boolean has no "empty" state; explicit reseed on every part-change