fix(fusion_claims): default booking description + isolate order-less task test

Review follow-up: the base fusion.technician.task.description is required=True and
non-in-store tasks require an address (_check_address_required). So:
- action_book_from_wizard now defaults description to 'Service booking' when the
  payload carries neither description nor issue (avoids a required-field failure).
- test_task_without_order_is_allowed now sets description + is_in_store=True so it
  exercises only the relaxed _check_order_link, not those unrelated base constraints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-04 01:09:14 -04:00
parent 92e8a18fcb
commit d457b86eaa
2 changed files with 6 additions and 2 deletions

View File

@@ -533,7 +533,7 @@ class FusionTechnicianTaskClaims(models.Model):
'duration_hours': dur, 'duration_hours': dur,
'is_in_store': in_shop, 'is_in_store': in_shop,
'x_fc_service_call_type': '%s_%s' % (category, timing), 'x_fc_service_call_type': '%s_%s' % (category, timing),
'description': payload.get('description') or payload.get('issue') or '', 'description': payload.get('description') or payload.get('issue') or _('Service booking'),
} }
if partner: if partner:
task_vals['partner_id'] = partner.id task_vals['partner_id'] = partner.id

View File

@@ -18,11 +18,15 @@ class TestServiceBooking(TransactionCase):
}) })
def test_task_without_order_is_allowed(self): def test_task_without_order_is_allowed(self):
# repair for a brand-new client: no SO/PO must NOT raise after the relax # No SO/PO must NOT raise after the relax. description is required and a
# non-in-store task needs an address, so set both here to isolate the test
# to the order-link relaxation (not those unrelated base constraints).
t = self.Task.create({ t = self.Task.create({
'task_type': 'repair', 'task_type': 'repair',
'technician_id': self.tech.id, 'technician_id': self.tech.id,
'scheduled_date': date(2026, 6, 3), 'scheduled_date': date(2026, 6, 3),
'description': 'Test repair',
'is_in_store': True,
}) })
self.assertTrue(t.id) self.assertTrue(t.id)