When a sales order is created from User A which has User B as account manager, the following email is sent:
Dear User B,
You have been assigned to the sales order SO-0058.
<View sales order>
Powered by Odoo.
Similar email is sent when an invoice is created.
Where this template can be modified? Is there any way to disable this internal notifications globaly?
You can find that notification in the module mail
, folder views
, file mail_templates.xml
.
The XML ID of the template you're looking for is message_user_assigned
.
In the same module, folder models
, file mail_thread.py
, there's the action of sending that notification:
@api.multi
def _message_auto_subscribe_notify(self, partner_ids):
""" Notify newly subscribed followers of the last posted message.
:param partner_ids : the list of partner to add as needaction partner of the last message
(This excludes the current partner)
"""
if not partner_ids:
return
if self.env.context.get('mail_auto_subscribe_no_notify'):
return
# send the email only to the current record and not all the ids matching active_domain !
# by default, send_mail for mass_mail use the active_domain instead of active_ids.
if 'active_domain' in self.env.context:
ctx = dict(self.env.context)
ctx.pop('active_domain')
self = self.with_context(ctx)
for record in self:
record.message_post_with_view(
'mail.message_user_assigned',
composition_mode='mass_mail',
partner_ids=[(4, pid) for pid in partner_ids],
auto_delete=True,
auto_delete_message=True,
parent_id=False, # override accidental context defaults
subtype_id=self.env.ref('mail.mt_note').id)
And this action is performed in your cases because sale.order
and account.invoice
models inherit from mail.thread
:
class AccountInvoice(models.Model):
_name = "account.invoice"
_inherit = ['mail.thread']
_description = "Invoice"
_order = "date_invoice desc, number desc, id desc"
I don't recommend you to remove that _inherit
. I think it'd be better to overwrite _message_auto_subscribe_notify
method to check the active model and do nothing if this is sale.order
or account.invoice
.