# -*- coding: utf-8 -*- # Copyright 2024-2026 Nexa Systems Inc. # License OPL-1 (Odoo Proprietary License v1.0) from odoo import fields, models class FusionTechnicianTaskRepairs(models.Model): """Adds the back-link from fusion.technician.task to repair.order so repairs and tasks share one timeline. """ _inherit = 'fusion.technician.task' x_fc_repair_order_id = fields.Many2one( 'repair.order', string='Repair Order', ondelete='set null', index=True, tracking=True, help='Repair order this task fulfils. Set automatically when the intake ' 'wizard auto-creates a draft task for urgent / safety calls.', ) x_fc_repair_intake_session_id = fields.Char( related='x_fc_repair_order_id.x_fc_intake_session_id', string='Intake Session', store=True, index=True, ) def action_view_repair_order(self): self.ensure_one() if not self.x_fc_repair_order_id: return False return { 'type': 'ir.actions.act_window', 'name': self.x_fc_repair_order_id.name, 'res_model': 'repair.order', 'view_mode': 'form', 'res_id': self.x_fc_repair_order_id.id, }