Files
mymach_fleet_intelligence/test_script.py

28 lines
1.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import uuid
print("\n--- TEST BAŞLIYOR ---")
partner = env['res.partner'].create({'name': 'Test Sürücü'})
dept = env['hr.department'].create({'name': 'Test Departmanı'})
employee = env['hr.employee'].create({'name': 'Test Çalışan', 'work_contact_id': partner.id, 'department_id': dept.id})
contract = env['mymach.fleet.contract'].create({
'name': 'TEST-2026',
'driver_id': partner.id,
'personal_use_policy': 'limit',
'max_km_limit': 1000,
'commute_allowed': 'allowed',
'personal_device_gps_allowed': True,
'company_phone_device_id': str(uuid.uuid4())
})
print("TEST_RESULT_START")
print("Sözleşme ID:", contract.id)
print("Sözleşme Adı:", contract.name)
print("Sürücü:", contract.driver_id.name)
print("İlgili Çalışan:", contract.employee_id.name if contract.employee_id else 'Yok')
print("Departman:", contract.department_id.name if contract.department_id else 'Yok')
print("KM Limiti:", contract.max_km_limit)
print("TEST_RESULT_END")
print("--- TEST BİTTİ ---\n")
env.cr.rollback() # Test verilerini geri al