-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] Disable auto subscribe on projects
- Loading branch information
1 parent
5282136
commit 52f1b79
Showing
6 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
############################################################################### | ||
# For copyright and license notices, see __manifest__.py file in root directory | ||
############################################################################### | ||
from . import project_project | ||
from . import project_task | ||
from . import res_users |
14 changes: 14 additions & 0 deletions
14
project_task_disable_auto_subscribe/models/project_project.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
############################################################################### | ||
# For copyright and license notices, see __manifest__.py file in root directory | ||
############################################################################### | ||
from odoo import models | ||
|
||
|
||
class Project(models.Model): | ||
_inherit = 'project.project' | ||
|
||
def create(self, vals): | ||
user_id = self.env['res.users'].browse(self._context['uid']) | ||
if not user_id.project_disable_auto_subscribe: | ||
return super().create(vals) | ||
return super().with_context(mail_create_nosubscribe=True).create(vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
############################################################################### | ||
# For copyright and license notices, see __manifest__.py file in root directory | ||
############################################################################### | ||
from odoo import api, models | ||
from odoo import models | ||
|
||
|
||
class ProjectTask(models.Model): | ||
_inherit = 'project.task' | ||
|
||
@api.multi | ||
def create(self, vals): | ||
user_id = self.env['res.users'].browse(self._context['uid']) | ||
if not user_id.project_task_disable_auto_subscribe: | ||
return super().create(vals) | ||
return super(ProjectTask, self.with_context( | ||
mail_create_nosubscribe=True)).create(vals) | ||
return super().with_context(mail_create_nosubscribe=True).create(vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters