Files
Odoo-Modules/fusion_plating/fusion_plating_quality/scripts/step7_verify.py
gsinghpal 8c76a16366 chore(plating): de-dash shipped code + intake-neutral customer emails
Replace em-dashes and en-dashes with hyphens across 789 shipped source
files (py/xml/js/scss) so the delivered module reads as human-written;
em-dashes had become a recognizable AI-generated tell. Internal .md dev
notes are excluded. The WO-sticker mojibake strippers keep their dash
search targets (now written — / –). No logic changes: comments
and display strings only; validated with py_compile + lxml parse.

Rewrite the 7 customer notification emails to be intake-neutral
(ship-in / drop-off / pickup) and repair-aware, and fix the Shipped
email documents line (packing slip vs bill of lading; certificate only
when issued). Subjects use a hyphen separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 00:16:19 -04:00

94 lines
3.2 KiB
Python

# Step 7 - Tom (Shipper) walks the delivery from draft to delivered.
# Test:
# A) Delivery exists post-job-done - what fields visible? what state?
# B) Try action_start_route without driver → must block
# C) Assign driver + vehicle + box count, schedule
# D) Try action_mark_delivered without POD → must block
# E) Capture POD, mark delivered, verify cert + chain of custody
so = env['sale.order'].browse(423) # Step 3's SO
job = env['fp.job'].search([('sale_order_id', '=', so.id)], limit=1)
Delivery = env['fusion.plating.delivery']
delivery = Delivery.search([('x_fc_job_id', '=', job.id)], limit=1)
print(f'[Tom] Looking at delivery {delivery.name}')
print()
print('Visible header on delivery form:')
print(f' partner_id: {delivery.partner_id.name}')
print(f' delivery_address_id: {delivery.delivery_address_id.name if delivery.delivery_address_id else None}')
print(f' contact_name: {delivery.contact_name}')
print(f' contact_phone: {delivery.contact_phone}')
print(f' job_ref: {delivery.job_ref}')
print(f' state: {delivery.state}')
print(f' scheduled_date: {delivery.scheduled_date}')
print(f' assigned_driver_id: {delivery.assigned_driver_id.name if delivery.assigned_driver_id else None}')
print(f' vehicle_id: {delivery.vehicle_id.name if delivery.vehicle_id else None}')
print(f' source_facility_id: {delivery.source_facility_id.name if delivery.source_facility_id else None}')
print(f' tdg_required: {delivery.tdg_required}')
print(f' pod_id: {delivery.pod_id.name if delivery.pod_id else None}')
# Tom schedules.
print()
print('[Tom] Clicks "Schedule"')
delivery.action_schedule()
print(f' state={delivery.state}')
# Tom tries to start route WITHOUT assigning a driver.
print()
print('[Tom] Tries Start Route without driver:')
try:
delivery.action_start_route()
print(' ❌ Got past driver gate without assignment!')
except Exception as e:
print(f' ✓ blocked: {str(e)[:120]}')
# Assign a driver (any user).
driver = env.user
delivery.assigned_driver_id = driver.id
delivery.x_fc_box_count_out = 3
print()
print(f'[Tom] Assigned driver: {driver.name}, box_count_out=3')
# Now start route.
print()
print('[Tom] Clicks Start Route:')
try:
delivery.action_start_route()
print(f' state={delivery.state}')
print(f' custody events: {delivery.custody_event_count}')
except Exception as e:
print(f'{e}')
# Tom tries to mark delivered without POD.
print()
print('[Tom] Tries Mark Delivered without POD:')
try:
delivery.action_mark_delivered()
print(' ❌ Got past POD gate without capture!')
except Exception as e:
print(f' ✓ blocked: {str(e)[:120]}')
# Tom captures POD.
POD = env['fusion.plating.proof.of.delivery']
pod = POD.create({
'delivery_id': delivery.id,
'recipient_name': 'Mark at receiving',
})
delivery.pod_id = pod.id
print()
print(f'[Tom] Captured POD: {pod.name}, recipient="{pod.recipient_name}"')
# Mark delivered.
print()
print('[Tom] Clicks Mark Delivered:')
try:
delivery.action_mark_delivered()
print(f' state={delivery.state}, delivered_at={delivery.delivered_at}')
print(f' custody events: {delivery.custody_event_count}')
except Exception as e:
print(f'{e}')
env.cr.commit()
print()
print('== Step 7 complete ==')