Hello,
How can I strict permission mark done on mail thread so that only the staff that I sent schedule activity is the only one can "mark done" and/or maybe also "cancel"
i'm using this and it works great
self.env['mail.activity'].create({
'activity_type_id': self.env.ref('custom_module.mail_activity_custom').id,
'note': 'Report please confirm',
'res_id': self.id,
'res_model_id': self.env.ref('custom_module.model_custom').id,
'user_id': user_id
})
the problem is that i/creator can also click it as mark done and that would make the notification for the targeted staff to disappear, i have to make it strict policy that the target staff is the one that click it (except for super admin)
Thank you,
If the mark as done button is calling a python function, you can restrict this by adding a condition inside the function. You can just add an if condition to check whether the assigned user is the same or not and execute accordingly. You will have the assigned user in any field, seems it is user_id from your code, then you can get the current user/logged in user using self.env.user.id, you can compare the values in this two and execute function only if both are same.