Relaxes _check_order_link to a no-op (service bookings auto-create their SO; in-shop/walk-in tasks may have none) and adds x_fc_is_service_repair on sale.order. The 'Service Repair' crm.tag from the plan is intentionally omitted: fusion_claims does not depend on crm and sale.order has no tag_ids; the boolean flag is the repair-SO identity. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
from datetime import date
|
|
from odoo.tests.common import TransactionCase, tagged
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestServiceBooking(TransactionCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super().setUpClass()
|
|
cls.Task = cls.env['fusion.technician.task']
|
|
# technician_id is required on a task (domain x_fc_is_field_staff=True).
|
|
cls.tech = cls.env['res.users'].create({
|
|
'name': 'Service Booking Tech',
|
|
'login': 'svcbook_tech',
|
|
'x_fc_is_field_staff': True,
|
|
})
|
|
|
|
def test_task_without_order_is_allowed(self):
|
|
# repair for a brand-new client: no SO/PO must NOT raise after the relax
|
|
t = self.Task.create({
|
|
'task_type': 'repair',
|
|
'technician_id': self.tech.id,
|
|
'scheduled_date': date(2026, 6, 3),
|
|
})
|
|
self.assertTrue(t.id)
|
|
|
|
def test_sale_order_has_service_repair_flag(self):
|
|
so = self.env['sale.order'].new({})
|
|
self.assertIn('x_fc_is_service_repair', so._fields)
|