feat(fusion_tasks): delivery-specific fields + reduced task types
Add delivery integration fields (delivery_id, sale_order_id, portal_job_id, packages_count, weight_total, requires_signature, requires_photo, coc_attachment_id). Reduce task_type selection to delivery/pickup/return/rush with matching duration defaults. Add delivery cascade in action_complete_task() that calls delivery_id.action_mark_delivered() on completion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,19 @@ class FusionTechnicianTask(models.Model):
|
||||
)
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
# ----- Delivery integration -----
|
||||
delivery_id = fields.Many2one(
|
||||
'fusion.plating.delivery', string='Delivery',
|
||||
help='Linked delivery record from fusion_plating_logistics.',
|
||||
)
|
||||
sale_order_id = fields.Many2one('sale.order', string='Sale Order')
|
||||
portal_job_id = fields.Many2one('fusion.plating.portal.job', string='Portal Job')
|
||||
packages_count = fields.Integer(string='Packages', help='Number of boxes/crates.')
|
||||
weight_total = fields.Float(string='Total Weight (kg)')
|
||||
requires_signature = fields.Boolean(string='Requires Signature')
|
||||
requires_photo = fields.Boolean(string='Requires Photo')
|
||||
coc_attachment_id = fields.Many2one('ir.attachment', string='CoC Document')
|
||||
|
||||
client_display_name = fields.Char(
|
||||
compute='_compute_client_display', string='Client Name (Display)',
|
||||
)
|
||||
@@ -135,14 +148,9 @@ class FusionTechnicianTask(models.Model):
|
||||
|
||||
task_type = fields.Selection([
|
||||
('delivery', 'Delivery'),
|
||||
('repair', 'Repair'),
|
||||
('pickup', 'Pickup'),
|
||||
('troubleshoot', 'Troubleshooting'),
|
||||
('assessment', 'Assessment'),
|
||||
('installation', 'Installation'),
|
||||
('maintenance', 'Maintenance'),
|
||||
('ltc_visit', 'LTC Visit'),
|
||||
('other', 'Other'),
|
||||
('return', 'Return'),
|
||||
('rush', 'Rush Delivery'),
|
||||
], string='Task Type', required=True, default='delivery', tracking=True)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
@@ -201,14 +209,9 @@ class FusionTechnicianTask(models.Model):
|
||||
# Task type -> default duration mapping
|
||||
TASK_TYPE_DURATIONS = {
|
||||
'delivery': 1.0,
|
||||
'repair': 2.0,
|
||||
'pickup': 0.5,
|
||||
'troubleshoot': 1.5,
|
||||
'assessment': 1.5,
|
||||
'installation': 2.0,
|
||||
'maintenance': 1.5,
|
||||
'ltc_visit': 3.0,
|
||||
'other': 1.0,
|
||||
'return': 1.0,
|
||||
'rush': 0.5,
|
||||
}
|
||||
|
||||
# Previous task travel warning banner
|
||||
@@ -1909,6 +1912,13 @@ class FusionTechnicianTask(models.Model):
|
||||
# Recalculate travel for remaining tasks from this completion location
|
||||
task._recalculate_remaining_tasks_travel()
|
||||
|
||||
# Cascade to delivery if linked
|
||||
if task.delivery_id:
|
||||
try:
|
||||
task.delivery_id.action_mark_delivered()
|
||||
except Exception:
|
||||
pass # Delivery cascade is best-effort
|
||||
|
||||
task._on_complete_extra()
|
||||
|
||||
def _check_completion_requirements(self):
|
||||
|
||||
Reference in New Issue
Block a user