Odoo Ajuda


4 Respostas
LukaszK Polônia
05/09/19 09:23

I've got that same problem. 

Change this:

add_user_as_follower = request.env['mail.followers'].sudo().create({
    'partner_id': partner_id,
    'res_model': 'project.issue',
    'res_id': new_ticket_id.id



partner_list --> list of all ID you wanna add. ( example: [34, 2342, 324] )

and it's add users with subscription


Shawn Varghese Emirados Árabes Unidos

--Shawn Varghese--
| 5 3 10
Dubai, Emirados Árabes Unidos
--Shawn Varghese--

Shawn Varghese Emirados Árabes Unidos
23/03/16 15:34

Hi Yenthe,

Are you referring to the message subtypes? You can normally configure that in the following way:

Example taken from sale.py:


def _track_subtype(self, init_values):


if 'state' in init_values and self.state == 'sale':

return 'sale.mt_order_confirmed'

elif 'state' in init_values and self.state == 'sent':

return 'sale.mt_order_sent'

return super(SaleOrder, self)._track_subtype(init_values)

We use the _track_subtype method to track the state variable. Therefore, whenever the state is changed and moves to 'sale' state, the message subtype sale.mt_order_confirmed is used for the automatic e-mail to followers. This subtype will be defined in XML as :

<record id="mt_order_confirmed" model="mail.message.subtype">

<field name="name">Sales Order Confirmed</field>

<field name="res_model">sale.order</field>

<field name="default" eval="False"/>

<field name="description">Quotation confirmed</field>


Here, if you change the default field value to true, followers of the document will automatically get subscribed to this message type. I imagine something similar will have been done for the Issues module in the screenshot you shared.

Also, the automatic e-mail that gets sent will include details of the changes. You can choose which details to include by using the track_visibility parameter:


     state = fields.Selection([

('draft', 'Quotation'),

('sent', 'Quotation Sent'),

('sale', 'Sale Order'),

('done', 'Done'),

('cancel', 'Cancelled'),

], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')


Hope this is what you were referring to.

2 Comentários
ePillars Systems LLC, Shawn Varghese Emirados Árabes Unidos
23/03/16 15:42

Also, isn't the Discussions default to True? I just tried adding a customer as a follower, but I found that they were automatically subscribed to Discussions... Also, if you navigate to Settings > Technical > Subtypes, you can configure which ones should be subscribed by default.

Yenthe Van Ginneken Bélgica
29/03/16 03:04

@Shawn thank you for the answer but I'm not talking about the states at the top of a record (the progressbar), I'm talking about the followers on a record and how to automatically give them specific settings. The Discussions its followers are not by default configured by my case because I add them through Python, which I'm doing besides the default behaviour.

Faça uma Pergunta
Keep Informed
1 seguidor (es)
About This Community

This platform 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now