Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
4182 Widoki

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?

Awatar
Odrzuć
Autor

@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

Najlepsza odpowiedź
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
    

Awatar
Odrzuć
Autor

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.

Najlepsza odpowiedź

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

Awatar
Odrzuć

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()

Powiązane posty Odpowiedzi Widoki Czynność
0
wrz 24
1242
0
maj 24
26
1
kwi 24
4611
0
mar 24
1547
0
mar 24
1621