[NEW] helpdesk_transfer_timesheet_to_task: assign the timesheets ticket to the linked task
This commit is contained in:
committed by
Stéphan Sainléger
parent
57c5815324
commit
28ae6f5572
@@ -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]
|
Reference in New Issue
Block a user