This commit is contained in:
gsinghpal
2026-05-22 18:01:31 -04:00
parent d127e19b45
commit f661724c72
34 changed files with 1011 additions and 59 deletions

View File

@@ -160,14 +160,14 @@ class FusionShipment(models.Model):
vals['packing_list_attachment_id'] = (
delivery.packing_list_attachment_id.id
)
# Once a tracking number exists, the parts have been picked
# by the carrier (or are about to be) — advance the portal
# state to 'shipped' so the customer sees their order is
# on its way. The 'delivered' status flips when FedEx
# tracking reports the delivery.
if self.tracking_number and portal.state in (
'received', 'in_progress', 'ready_to_ship',
):
vals['state'] = 'shipped'
if vals:
portal.sudo().write(vals)
# State is now derived centrally — see
# fusion.plating.portal.job._fp_recompute_portal_state. It
# only promotes to 'shipped' when every linked WO is done
# AND the shipment.status is 'shipped' or 'delivered'. A
# FedEx label booked early (tracking number without the
# carrier actually picking up) no longer leapfrogs the
# shop floor.
if hasattr(portal, '_fp_recompute_portal_state'):
portal.sudo()._fp_recompute_portal_state()