changes
This commit is contained in:
@@ -301,6 +301,26 @@ class FpJob(models.Model):
|
||||
job.part_catalog_id.part_number if job.part_catalog_id
|
||||
else job.product_id.default_code or job.name
|
||||
)
|
||||
# When the scrap was bumped from the tablet, the operator
|
||||
# was prompted for a reason and we passed it via context as
|
||||
# `fp_scrap_reason` (see /fp/shopfloor/bump_qty_scrapped).
|
||||
# Prepend that reason to the description so the audit row
|
||||
# captures what the operator actually typed instead of the
|
||||
# generic "OPERATOR: replace this text..." placeholder.
|
||||
scrap_reason = self.env.context.get('fp_scrap_reason')
|
||||
if scrap_reason:
|
||||
description = _(
|
||||
'Operator reason: %s\n\n'
|
||||
'Auto-spawned from job %s scrap update by %s: '
|
||||
'qty_scrapped went from %g to %g (delta %g).'
|
||||
) % (scrap_reason, job.name, self.env.user.name, old, new, delta)
|
||||
else:
|
||||
description = _(
|
||||
'Auto-spawned from job %s scrap update by %s: '
|
||||
'qty_scrapped went from %g to %g (delta %g). '
|
||||
'OPERATOR: replace this text with the actual '
|
||||
'reason (drop / contamination / out-of-spec / etc).'
|
||||
) % (job.name, self.env.user.name, old, new, delta)
|
||||
try:
|
||||
hold = Hold.create({
|
||||
'job_id': job.id,
|
||||
@@ -309,12 +329,7 @@ class FpJob(models.Model):
|
||||
'qty_original': int(job.qty or 0),
|
||||
'mark_for_scrap': True,
|
||||
'hold_reason': 'other',
|
||||
'description': _(
|
||||
'Auto-spawned from job %s scrap update by %s: '
|
||||
'qty_scrapped went from %g to %g (delta %g). '
|
||||
'OPERATOR: replace this text with the actual '
|
||||
'reason (drop / contamination / out-of-spec / etc).'
|
||||
) % (job.name, self.env.user.name, old, new, delta),
|
||||
'description': description,
|
||||
'facility_id': facility.id if facility else False,
|
||||
})
|
||||
job.message_post(body=_Markup(_(
|
||||
|
||||
Reference in New Issue
Block a user