From 86e9fdead8a10aa5be2cf8f6149b53c849b3798a Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Thu, 4 Jun 2026 14:29:25 -0400 Subject: [PATCH] fix(jobs): guard res.partner.mobile read in delivery defaults (Odoo 19) res.partner has no `mobile` field in this Odoo 19 build, so _fp_resolve_delivery_defaults crashed with AttributeError when a job's last shop step finished and auto-created a delivery (button_finish -> _fp_check_advance_post_shop -> _fp_create_delivery). This blocked operators from finishing the step at all. Guard the read with the codebase's 'x' in obj._fields pattern so it falls back to phone, and still picks up mobile on instances that define it. Deployed + verified on entech (restart, no -u; pure Python change). Co-Authored-By: Claude Opus 4.8 (1M context) --- fusion_plating/fusion_plating_jobs/models/fp_job.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fusion_plating/fusion_plating_jobs/models/fp_job.py b/fusion_plating/fusion_plating_jobs/models/fp_job.py index 31883e0f..9958b8d7 100644 --- a/fusion_plating/fusion_plating_jobs/models/fp_job.py +++ b/fusion_plating/fusion_plating_jobs/models/fp_job.py @@ -2379,7 +2379,14 @@ class FpJob(models.Model): if 'contact_name' in Delivery._fields and ship_to.name: vals['contact_name'] = ship_to.name if 'contact_phone' in Delivery._fields: - vals['contact_phone'] = ship_to.phone or ship_to.mobile or '' + # res.partner has no `mobile` field in this Odoo 19 build — + # guard it so the read can't AttributeError (and still picks + # up mobile on instances that do define it). + vals['contact_phone'] = ( + ship_to.phone + or (ship_to.mobile if 'mobile' in ship_to._fields else '') + or '' + ) # Scheduled date — operator can adjust; this just primes it # so they're not staring at a blank field. if so and so.commitment_date and 'scheduled_date' in Delivery._fields: