I'm trying to make it so when an IT tech is assigned to a Helpdesk ticket, the Ticket's stage goes from 'New' to 'Assigned'. However, when I add the tech, the stage doesn't change. I have seen that 'onchange' doesn't work in the event that you have a clickable Statusbar widget, which we have set up for our tickets. Unfortunately, I haven't seen a good workaround, but perhaps I'm missing something. Can anyone give me some suggestions?
@api.onchange('user_id')
def tmg_assigned_user_id(self)
self.ensure_one()
for ticket in self:
if ticket.user_id:
ticket.stage_id.sequence = 1
Why are you changing the sequence of the stage_id? What happens if you just change the stage_id to 1? (Also, tip: Ideally you should SEARCH for the Assigned status to make sure you have the correct ID)
We wanted to make the stage change automatically when a tech is assigned to a ticket, so that way, the ticket status just doesn't stay as 'New'. If I just change the stage_id to 1, nothing happens as well. Our 'Assigned' status is under sequence 1, while 'New' is 0 and so on
I understand what you want to do, I just wanted to point out that what your code is trying to do is change the sequence of the stage, not change the stage. Seems like you've tried ticket.stage_id = {something} also?
Thanks for bringing that up. I actually did just notice that today. I didn't realize that's what was happening. I have tried ticket.stage_id = 'In Progress' but unfortunately to no avail. I think this also just ended up changing the ticket status name in sequence 0 to "In Progress"