add mail_follower_option module

This commit is contained in:
Chafique
2019-09-26 12:11:09 +02:00
committed by Hpar
parent 6377f0984d
commit 31483abb99
7 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import mail_follower
from . import ir_model

View File

@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class IrModel(models.Model):
_inherit = 'ir.model'
mail_follower = fields.Boolean(string='Follow', default=False,
help='Check if you want create followers'
' on this model')

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from odoo import models, api
class Followers(models.Model):
_inherit = 'mail.followers'
@api.model
def create(self, vals):
# Do not implicitly create followers on an object
model = self.env['ir.model'].search([
('model', '=', vals['res_model']),
('mail_follower', '=', True),
], limit=1)
if not model:
return
return super(Followers, self).create(vals)