feat: add fusion_tasks module for field service management
Standalone module extracted from fusion_claims providing technician scheduling, route simulation with Google Maps, GPS tracking, and cross-instance task sync between odoo-westin and odoo-mobility. Includes fix for route simulation: added Directions API error logging to diagnose silent failures from conflicting Google Maps API keys. Made-with: Cursor
This commit is contained in:
36
fusion_tasks/__init__.py
Normal file
36
fusion_tasks/__init__.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2024-2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
def _fusion_tasks_post_init(env):
|
||||
"""Post-install hook for fusion_tasks.
|
||||
|
||||
1. Sets default ICP values (upsert - safe if keys already exist).
|
||||
2. Adds all active internal users to group_field_technician so
|
||||
the Field Service menus are visible immediately after install.
|
||||
"""
|
||||
ICP = env['ir.config_parameter'].sudo()
|
||||
defaults = {
|
||||
'fusion_claims.google_maps_api_key': '',
|
||||
'fusion_claims.store_open_hour': '9.0',
|
||||
'fusion_claims.store_close_hour': '18.0',
|
||||
'fusion_claims.push_enabled': 'False',
|
||||
'fusion_claims.push_advance_minutes': '30',
|
||||
'fusion_claims.sync_instance_id': '',
|
||||
'fusion_claims.technician_start_address': '',
|
||||
}
|
||||
for key, default_value in defaults.items():
|
||||
if not ICP.get_param(key):
|
||||
ICP.set_param(key, default_value)
|
||||
|
||||
# Add all active internal users to Field Technician group
|
||||
ft_group = env.ref('fusion_tasks.group_field_technician', raise_if_not_found=False)
|
||||
if ft_group:
|
||||
internal_users = env['res.users'].search([
|
||||
('active', '=', True),
|
||||
('share', '=', False),
|
||||
])
|
||||
ft_group.write({'user_ids': [(4, u.id) for u in internal_users]})
|
||||
Reference in New Issue
Block a user