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:
@@ -42,6 +42,20 @@ class SaleOrderLine(models.Model):
|
||||
return tail.lstrip(' \t\r\n-—–:').strip()
|
||||
return name
|
||||
|
||||
@api.onchange('x_fc_part_catalog_id')
|
||||
def _fp_onchange_part_load_description(self):
|
||||
"""Pre-fill name (customer-facing) + x_fc_internal_description from
|
||||
the part's latest description version, when empty (spec 2026-05-29)."""
|
||||
for line in self:
|
||||
part = line.x_fc_part_catalog_id
|
||||
if not part:
|
||||
continue
|
||||
descs = part._fp_resolve_line_descriptions()
|
||||
if not line.name and descs['customer_facing']:
|
||||
line.name = descs['customer_facing']
|
||||
if not line.x_fc_internal_description and descs['internal']:
|
||||
line.x_fc_internal_description = descs['internal']
|
||||
|
||||
x_fc_part_catalog_id = fields.Many2one(
|
||||
'fp.part.catalog', string='Part',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user