[MIG] helpdesk_transfer_timesheet_to_task: migrate to 18.0

This commit is contained in:
Stéphan Sainléger
2026-03-17 21:45:49 +01:00
parent 48185f0124
commit bf91f01387
8 changed files with 282 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import helpdesk_ticket

View File

@@ -0,0 +1,12 @@
from odoo import models, api, Command
class HelpdeskTicket(models.Model):
_inherit = "helpdesk.ticket"
@api.onchange("task_id")
def _onchange_task_id(self):
for record in self:
if record.timesheet_ids and record.task_id:
not_yet_invoiced_timesheet_ids = [t.id for t in record.timesheet_ids if not t.timesheet_invoice_id]
record.task_id.timesheet_ids = [Command.link(t_id) for t_id in not_yet_invoiced_timesheet_ids]