Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
4180 Weergaven

I'd like to create an automated action that removes a specific follower from a helpdesk ticket when it moves to a certain stage. There are always two other followers on the ticket by that stage, and I want those to remain, The specific follower I want removed is always the same one. Does anyone know how I can do this please?

Avatar
Annuleer
Auteur

@Mindaugas, thank you for the link. However, I can't find the specific info I need here - I need to remove a named follower from a helpdesk ticket

Beste antwoord
please refer following onchange method as per your question.

@api.onchange('stage_id')
def onchange_stage_id(self):
subtype_list = []
# here 1 is the stage where we want to remove follower
if self
.stage_id and self.stage_id.id == 1:
# 1611 is the partner id for specific partner
mail_follower_ids = self.env['mail.followers'].search(
[ ('partner_id', '=', 1611),('res_model', '=', 'project.task'), ('res_id', '=',                                                     self.id or self._origin.id)])
subtype_list += mail_follower_ids.subtype_ids.ids
# 21 is the subtype id for "discussion"
subtype_list and subtype_list.count(21)!=0 and subtype_list.remove(21)
self.message_subscribe([1611], subtype_ids=subtype_list)

Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat 380015
    

Avatar
Annuleer
Auteur

Hi, thank you for this, but it's not clear where I enter this in the Automated Action?

you have to create new server action and select python code. need to modify stage id and subtype id as per your database.

Beste antwoord

Hello Debbie Watkins,

You can remove a Follower from Helpdesk ticket using Automated Action.

Find Example in comment.

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Annuleer

For Example -

Note - Check Indentation of the code after pasting the code

- Create an automated action by adding
name, model( Helpdesk Ticket (helpdesk.ticket) as per your requirement),
trigger(update as per your requirement), Trigger fields (status as per your requirement),
Before Update Domain and apply on field( add as per your needs), Action To Do ( Execute Python Code )
- Search the partner you want to remove.

- In the Python Code Below Paste this code:-
partner = env['res.partner'].search([('name','=','Azure Interior')])
if records.message_follower_ids:
for record in records.message_follower_ids:
if record.partner_id == partner:
record.unlink()

Gerelateerde posts Antwoorden Weergaven Activiteit
0
sep. 24
1231
0
mei 24
26
1
apr. 24
4604
0
mrt. 24
1542
0
mrt. 24
1616