feat(receiving): technicians can count+close receivings from the tablet
ACL: grant group_fp_technician write+create on fp.receiving / line / damage. sudo the internal sale.order x_fc_receiving_status write so a non-privileged technician isn't blocked inside action_mark_counted / action_close. Tests deferred to entech (local Docker unavailable this session). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1358,17 +1358,21 @@ class FpReceiving(models.Model):
|
||||
for rec in self:
|
||||
if not rec.sale_order_id:
|
||||
continue
|
||||
# Internal denormalized status field — elevate the write so a
|
||||
# non-privileged technician (tablet receiving) isn't blocked by
|
||||
# sale.order ACL inside action_mark_counted / action_close.
|
||||
so = rec.sale_order_id.sudo()
|
||||
if rec.state == 'closed':
|
||||
rec.sale_order_id.x_fc_receiving_status = 'received'
|
||||
so.x_fc_receiving_status = 'received'
|
||||
elif rec.state in ('counted', 'staged'):
|
||||
rec.sale_order_id.x_fc_receiving_status = 'partial'
|
||||
so.x_fc_receiving_status = 'partial'
|
||||
# Legacy states preserved.
|
||||
elif rec.state in ('accepted', 'resolved'):
|
||||
rec.sale_order_id.x_fc_receiving_status = 'received'
|
||||
so.x_fc_receiving_status = 'received'
|
||||
elif rec.state in ('discrepancy', 'inspecting'):
|
||||
rec.sale_order_id.x_fc_receiving_status = 'partial'
|
||||
so.x_fc_receiving_status = 'partial'
|
||||
elif rec.state == 'draft':
|
||||
rec.sale_order_id.x_fc_receiving_status = 'not_received'
|
||||
so.x_fc_receiving_status = 'not_received'
|
||||
# Propagate the per-part qty onto the matching fp.job records
|
||||
# so the 2026-05-18 mark_done gate can see what was received.
|
||||
rec._update_job_qty_received()
|
||||
|
||||
Reference in New Issue
Block a user