refactor(fusion_tasks): update deps, config, crons for delivery context

- Change depends to [base, mail, hr, fusion_plating_logistics]
- Rename module to 'Fusion Plating -- Delivery Tasks'
- Replace all fusion_claims.* config params with fusion_tasks.*
- Remove sync crons (pull_remote_tasks, cleanup_old_shadows)
- Remove sync config ACL lines from ir.model.access.csv
- Replace sales_team group refs with hr/base equivalents
- Update license from OPL-1 to LGPL-3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-12 20:28:38 -04:00
parent e10bf9d8fd
commit 10607c48f0
11 changed files with 73 additions and 104 deletions

View File

@@ -237,5 +237,5 @@ class FusionEmailBuilderMixin(models.AbstractModel):
def _email_is_enabled(self):
"""Check if email notifications are enabled in settings."""
ICP = self.env['ir.config_parameter'].sudo()
val = ICP.get_param('fusion_claims.enable_email_notifications', 'True')
val = ICP.get_param('fusion_tasks.enable_email_notifications', 'True')
return val.lower() in ('true', '1', 'yes')

View File

@@ -11,7 +11,7 @@ class ResConfigSettings(models.TransientModel):
# Google Maps API Settings
fc_google_maps_api_key = fields.Char(
string='Google Maps API Key',
config_parameter='fusion_claims.google_maps_api_key',
config_parameter='fusion_tasks.google_maps_api_key',
help='API key for Google Maps Places autocomplete in address fields',
)
fc_google_review_url = fields.Char(
@@ -23,27 +23,27 @@ class ResConfigSettings(models.TransientModel):
# Technician Management
fc_store_open_hour = fields.Float(
string='Store Open Time',
config_parameter='fusion_claims.store_open_hour',
config_parameter='fusion_tasks.store_open_hour',
help='Store opening time for technician scheduling (e.g. 9.0 = 9:00 AM)',
)
fc_store_close_hour = fields.Float(
string='Store Close Time',
config_parameter='fusion_claims.store_close_hour',
config_parameter='fusion_tasks.store_close_hour',
help='Store closing time for technician scheduling (e.g. 18.0 = 6:00 PM)',
)
fc_google_distance_matrix_enabled = fields.Boolean(
string='Enable Distance Matrix',
config_parameter='fusion_claims.google_distance_matrix_enabled',
config_parameter='fusion_tasks.google_distance_matrix_enabled',
help='Enable Google Distance Matrix API for travel time calculations between technician tasks',
)
fc_technician_start_address = fields.Char(
string='Technician Start Address',
config_parameter='fusion_claims.technician_start_address',
config_parameter='fusion_tasks.technician_start_address',
help='Default start location for technician travel calculations (e.g. warehouse/office address)',
)
fc_location_retention_days = fields.Char(
string='Location History Retention (Days)',
config_parameter='fusion_claims.location_retention_days',
config_parameter='fusion_tasks.location_retention_days',
help='How many days to keep technician location history. '
'Leave empty = 30 days (1 month). '
'0 = delete at end of each day. '
@@ -53,21 +53,21 @@ class ResConfigSettings(models.TransientModel):
# Web Push Notifications
fc_push_enabled = fields.Boolean(
string='Enable Push Notifications',
config_parameter='fusion_claims.push_enabled',
config_parameter='fusion_tasks.push_enabled',
help='Enable web push notifications for technician tasks',
)
fc_vapid_public_key = fields.Char(
string='VAPID Public Key',
config_parameter='fusion_claims.vapid_public_key',
config_parameter='fusion_tasks.vapid_public_key',
help='Public key for Web Push VAPID authentication (auto-generated)',
)
fc_vapid_private_key = fields.Char(
string='VAPID Private Key',
config_parameter='fusion_claims.vapid_private_key',
config_parameter='fusion_tasks.vapid_private_key',
help='Private key for Web Push VAPID authentication (auto-generated)',
)
fc_push_advance_minutes = fields.Integer(
string='Notification Advance (min)',
config_parameter='fusion_claims.push_advance_minutes',
config_parameter='fusion_tasks.push_advance_minutes',
help='Send push notifications this many minutes before a scheduled task',
)

View File

@@ -29,7 +29,7 @@ class ResPartner(models.Model):
if not address or not address.strip():
return 0.0, 0.0
api_key = self.env['ir.config_parameter'].sudo().get_param(
'fusion_claims.google_maps_api_key', '')
'fusion_tasks.google_maps_api_key', '')
if not api_key:
return 0.0, 0.0
try:

View File

@@ -84,7 +84,7 @@ class FusionTechnicianLocation(models.Model):
""")
rows = self.env.cr.dictfetchall()
local_id = self.env['ir.config_parameter'].sudo().get_param(
'fusion_claims.sync_instance_id', '')
'fusion_tasks.sync_instance_id', '')
result = []
for row in rows:
user = self.env['res.users'].sudo().browse(row['user_id'])
@@ -104,13 +104,13 @@ class FusionTechnicianLocation(models.Model):
def _cron_cleanup_old_locations(self):
"""Remove location logs based on configurable retention setting.
Setting (fusion_claims.location_retention_days):
Setting (fusion_tasks.location_retention_days):
- Empty / not set => keep 30 days (default)
- "0" => delete at end of day (keep today only)
- "1" .. "N" => keep for N days
"""
ICP = self.env['ir.config_parameter'].sudo()
raw = (ICP.get_param('fusion_claims.location_retention_days') or '').strip()
raw = (ICP.get_param('fusion_tasks.location_retention_days') or '').strip()
if raw == '':
retention_days = 30 # default: 1 month

View File

@@ -52,11 +52,11 @@ class FusionTechnicianTask(models.Model):
"""Return (open_hour, close_hour) from settings. Defaults 9.0 / 18.0."""
ICP = self.env['ir.config_parameter'].sudo()
try:
open_h = float(ICP.get_param('fusion_claims.store_open_hour', '9.0') or '9.0')
open_h = float(ICP.get_param('fusion_tasks.store_open_hour', '9.0') or '9.0')
except (ValueError, TypeError):
open_h = 9.0
try:
close_h = float(ICP.get_param('fusion_claims.store_close_hour', '18.0') or '18.0')
close_h = float(ICP.get_param('fusion_tasks.store_close_hour', '18.0') or '18.0')
except (ValueError, TypeError):
close_h = 18.0
return (open_h, close_h)
@@ -938,7 +938,7 @@ class FusionTechnicianTask(models.Model):
Returns travel time in minutes, or 0 if unavailable."""
try:
api_key = self.env['ir.config_parameter'].sudo().get_param(
'fusion_claims.google_maps_api_key', '')
'fusion_tasks.google_maps_api_key', '')
if not api_key:
return 0
@@ -1385,7 +1385,7 @@ class FusionTechnicianTask(models.Model):
def _create_vals_fill(self, vals):
"""Hook: fill address from linked records during create.
Base implementation fills from partner_id. Override in fusion_claims
Base implementation fills from partner_id. Override in subclass
to also fill from sale_order_id or purchase_order_id.
"""
if vals.get('partner_id') and not vals.get('address_street'):
@@ -1396,7 +1396,7 @@ class FusionTechnicianTask(models.Model):
def _on_create_post_actions(self):
"""Hook: post-create side-effects for linked records.
Override in fusion_claims to post chatter messages to linked orders,
Override in subclass to post chatter messages to linked orders,
mark sale orders as ready for delivery, etc.
"""
pass
@@ -1556,12 +1556,12 @@ class FusionTechnicianTask(models.Model):
def _post_task_created_to_linked_order(self):
"""Hook: post task creation notice to linked order chatter.
Override in fusion_claims."""
Override in fusion_tasks."""
pass
def _mark_sale_order_ready_for_delivery(self):
"""Hook: mark linked sale orders as ready for delivery.
Override in fusion_claims."""
Override in fusion_tasks."""
pass
def _recalculate_day_travel_chains(self):
@@ -1584,7 +1584,7 @@ class FusionTechnicianTask(models.Model):
Priority:
1. Technician's personal x_fc_start_address (if set)
2. Company default HQ address (fusion_claims.technician_start_address)
2. Company default HQ address (fusion_tasks.technician_start_address)
Returns the address string or ''.
"""
tech_user = self.env['res.users'].sudo().browse(tech_id)
@@ -1592,7 +1592,7 @@ class FusionTechnicianTask(models.Model):
return tech_user.x_fc_start_address.strip()
# Fallback to company default
return (self.env['ir.config_parameter'].sudo()
.get_param('fusion_claims.technician_start_address', '') or '').strip()
.get_param('fusion_tasks.technician_start_address', '') or '').strip()
def _geocode_address_string(self, address, api_key):
"""Geocode an address string and return (lat, lng) or (0.0, 0.0)."""
@@ -1621,7 +1621,7 @@ class FusionTechnicianTask(models.Model):
For future dates, only 3 and 4 apply.
"""
ICP = self.env['ir.config_parameter'].sudo()
enabled = ICP.get_param('fusion_claims.google_distance_matrix_enabled', False)
enabled = ICP.get_param('fusion_tasks.google_distance_matrix_enabled', False)
if not enabled:
return
api_key = self._get_google_maps_api_key()
@@ -1731,7 +1731,7 @@ class FusionTechnicianTask(models.Model):
"""
self.ensure_one()
ICP = self.env['ir.config_parameter'].sudo()
if not ICP.get_param('fusion_claims.google_distance_matrix_enabled', False):
if not ICP.get_param('fusion_tasks.google_distance_matrix_enabled', False):
return
tech_id = self.technician_id.id
if not tech_id:
@@ -1752,7 +1752,7 @@ class FusionTechnicianTask(models.Model):
"""
self.ensure_one()
ICP = self.env['ir.config_parameter'].sudo()
if not ICP.get_param('fusion_claims.google_distance_matrix_enabled', False):
if not ICP.get_param('fusion_tasks.google_distance_matrix_enabled', False):
return
tech_id = self.technician_id.id
@@ -1913,12 +1913,12 @@ class FusionTechnicianTask(models.Model):
def _check_completion_requirements(self):
"""Hook: check additional requirements before task completion.
Override in fusion_claims for rental inspection checks."""
Override in subclass for rental inspection checks."""
pass
def _on_complete_extra(self):
"""Hook: additional side-effects after task completion.
Override in fusion_claims for ODSP advancement and rental inspection."""
Override in subclass for ODSP advancement and rental inspection."""
pass
def action_cancel_task(self):
@@ -1933,7 +1933,7 @@ class FusionTechnicianTask(models.Model):
def _on_cancel_extra(self):
"""Hook: additional side-effects after task cancellation.
Override in fusion_claims for sale order revert and email."""
Override in subclass for sale order revert and email."""
self._send_task_cancelled_email()
def action_reschedule(self):
@@ -1985,7 +1985,7 @@ class FusionTechnicianTask(models.Model):
def _post_completion_to_linked_order(self):
"""Hook: post completion notes to linked order chatter.
Override in fusion_claims."""
Override in fusion_tasks."""
pass
def _notify_scheduler_on_completion(self):
@@ -2086,15 +2086,15 @@ class FusionTechnicianTask(models.Model):
return {'to': to_emails, 'cc': list(set(cc_emails))}
def _send_task_cancelled_email(self):
"""Send cancellation email. Base: no-op. Override in fusion_claims."""
"""Send cancellation email. Base: no-op. Override in fusion_tasks."""
return False
def _send_task_scheduled_email(self):
"""Send scheduled email. Base: no-op. Override in fusion_claims."""
"""Send scheduled email. Base: no-op. Override in fusion_tasks."""
return False
def _send_task_rescheduled_email(self, old_date=None, old_start=None, old_end=None):
"""Send rescheduled email. Base: no-op. Override in fusion_claims."""
"""Send rescheduled email. Base: no-op. Override in fusion_tasks."""
return False
# ------------------------------------------------------------------
@@ -2105,14 +2105,14 @@ class FusionTechnicianTask(models.Model):
"""Return a record that has the _email_build mixin.
Base: returns self (task model inherits mixin).
Override in fusion_claims to prefer linked sale order.
Override in subclass to prefer linked sale order.
"""
return self
def _is_email_notifications_enabled(self):
"""Check if email notifications are enabled.
Base: always True. Override in fusion_claims to check
Base: always True. Override in subclass to check
linked sale order's notification settings.
"""
return True
@@ -2120,7 +2120,7 @@ class FusionTechnicianTask(models.Model):
def _get_linked_order(self):
"""Return the linked order record (SO or PO), or False.
Base: always False. Override in fusion_claims to return
Base: always False. Override in subclass to return
sale_order_id or purchase_order_id.
"""
return False
@@ -2336,7 +2336,7 @@ class FusionTechnicianTask(models.Model):
def _get_google_maps_api_key(self):
"""Get the Google Maps API key from config."""
return self.env['ir.config_parameter'].sudo().get_param(
'fusion_claims.google_maps_api_key', ''
'fusion_tasks.google_maps_api_key', ''
)
@api.model
@@ -2347,9 +2347,9 @@ class FusionTechnicianTask(models.Model):
domain: optional extra domain from the search bar filters.
"""
api_key = self.env['ir.config_parameter'].sudo().get_param(
'fusion_claims.google_maps_api_key', '')
'fusion_tasks.google_maps_api_key', '')
local_instance = self.env['ir.config_parameter'].sudo().get_param(
'fusion_claims.sync_instance_id', '')
'fusion_tasks.sync_instance_id', '')
base_domain = [
('status', 'not in', ['cancelled']),
]
@@ -2399,7 +2399,7 @@ class FusionTechnicianTask(models.Model):
hq_address = (
self.env['ir.config_parameter'].sudo()
.get_param('fusion_claims.technician_start_address', '') or ''
.get_param('fusion_tasks.technician_start_address', '') or ''
).strip()
hq_lat, hq_lng = 0.0, 0.0
@@ -2693,7 +2693,7 @@ class FusionTechnicianTask(models.Model):
tech and an in-app notification to the office (once per task).
"""
ICP = self.env['ir.config_parameter'].sudo()
push_enabled = ICP.get_param('fusion_claims.push_enabled', 'False')
push_enabled = ICP.get_param('fusion_tasks.push_enabled', 'False')
if push_enabled.lower() not in ('true', '1', 'yes'):
return
@@ -2801,8 +2801,8 @@ class FusionTechnicianTask(models.Model):
return
ICP = self.env['ir.config_parameter'].sudo()
vapid_private = ICP.get_param('fusion_claims.vapid_private_key', '')
vapid_public = ICP.get_param('fusion_claims.vapid_public_key', '')
vapid_private = ICP.get_param('fusion_tasks.vapid_private_key', '')
vapid_public = ICP.get_param('fusion_tasks.vapid_public_key', '')
if not vapid_private or not vapid_public:
_logger.warning("VAPID keys not configured, cannot send push notification")
return
@@ -2850,10 +2850,10 @@ class FusionTechnicianTask(models.Model):
def _cron_send_push_notifications(self):
"""Cron: Send push notifications for upcoming tasks."""
ICP = self.env['ir.config_parameter'].sudo()
if not ICP.get_param('fusion_claims.push_enabled', False):
if not ICP.get_param('fusion_tasks.push_enabled', False):
return
advance_minutes = int(ICP.get_param('fusion_claims.push_advance_minutes', '30'))
advance_minutes = int(ICP.get_param('fusion_tasks.push_advance_minutes', '30'))
local_now = self._local_now()
tasks = self.search([