changes
This commit is contained in:
@@ -1540,6 +1540,23 @@ class FpJob(models.Model):
|
||||
# qty tracking truly doesn't apply).
|
||||
skip_qty_gate = self.env.context.get('fp_skip_qty_reconcile')
|
||||
if not skip_qty_gate and job.qty:
|
||||
# Smooth the typical "clean close" case so the operator
|
||||
# doesn't have to manually type qty_done = ordered_qty
|
||||
# every time. Conditions for safe auto-fill:
|
||||
# - operator has NOT recorded any scrap or done qty
|
||||
# (so we're not overriding their explicit entry)
|
||||
# - the receiving closed with matching qty (parts
|
||||
# physically came in as expected)
|
||||
# - no visual-inspection rejects recorded
|
||||
# When any of those fail, fall through to the gate so
|
||||
# the operator reconciles by hand. Mirrors the receiving
|
||||
# `_update_job_qty_received` pattern: server fills the
|
||||
# obvious default, operator owns the edge cases.
|
||||
if (not job.qty_done and not job.qty_scrapped
|
||||
and not (job.qty_visual_inspection_rejects or 0)
|
||||
and job.qty_received
|
||||
and abs(job.qty_received - job.qty) < 0.0001):
|
||||
job.qty_done = job.qty
|
||||
accounted = (job.qty_done or 0) + (job.qty_scrapped or 0)
|
||||
if abs(accounted - job.qty) > 0.0001:
|
||||
raise UserError(_(
|
||||
|
||||
Reference in New Issue
Block a user