Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Adding Followers to mail_followers widget automatically from hr.employee

By
Eslam Ahmed
on 2/23/16, 4:37 AM 626 views

i'm writing a ticketing module and i need the assigned employee to a specific ticket to be automatically follow the ticket the thing as is it followers are added form res.partner model and i need to add them from hr.employee and res.partner

here is my work around 

python:

class ticket(models.Model):

_name = 'itmangement.ticket'

_description = 'IT Ticket Management Process'

_inherit = ['mail.thread', 'ir.needaction_mixin']

        #some other fields

        assigned_to_id = fields.Many2many('hr.employee', string="Assigned To")

        employee_message_follower_ids=fields.Many2many('hr.employee')

        @api.one

        def action_assign(self):

             self.employee_message_follower_ids = [(6,0,self.assigned_to_id.ids)]

and the view:
<div class="oe_chatter">
    <field name="message_follower_ids" widget="mail_followers"/>
    <field name="message_ids" widget="mail_thread"/>
</div>
<div class="oe_chatter">
    <field name="employee_message_follower_ids" widget="mail_followers"/>
</div>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/23/16, 4:37 AM
Seen: 626 times
Last updated: 2/23/16, 5:37 AM