@ -0,0 +1,50 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
No Automatic Subscription |
||||
|
====================================== |
||||
|
This module is used to stop the automatic subscription for the customers as the user need. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: Cybrosys Techno Solutions odoo@cybrosys.com |
||||
|
(V17) Rosmy John @cybrosys |
||||
|
(V18) Athira K @cybrosys |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
||||
|
|
||||
|
|
@ -0,0 +1,23 @@ |
|||||
|
"""no automatic subscription""" |
||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
@ -0,0 +1,42 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'No Automatic Subscription', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'summary': """To stop the automatic subscription.""", |
||||
|
'description': """To stop the automatic subscription for the customers as |
||||
|
the user need.""", |
||||
|
'category': 'Discuss', |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://cybrosys.com', |
||||
|
'depends': ['base', 'sale', 'mail'], |
||||
|
'data': [ |
||||
|
'views/res_config_settings_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <no_automatic_subscription> |
||||
|
|
||||
|
#### 19.06.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for No Automatic Subscription |
@ -0,0 +1,24 @@ |
|||||
|
"""no automatic subscription""" |
||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import res_config_settings |
||||
|
from . import mail_thread |
@ -0,0 +1,110 @@ |
|||||
|
"""Automatic subscription""" |
||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
|
class MailThread(models.AbstractModel): |
||||
|
"""Stop automatic subscription""" |
||||
|
_inherit = 'mail.thread' |
||||
|
|
||||
|
def message_subscribe(self, partner_ids=None, subtype_ids=None): |
||||
|
""" Main public API to add followers to a record set. Its main purpose |
||||
|
is to perform access rights checks before calling ` |
||||
|
`_message_subscribe``. """ |
||||
|
subscription_models = self.no_subscription() |
||||
|
if subscription_models: |
||||
|
for rec in self: |
||||
|
if rec._name not in subscription_models: |
||||
|
return super(MailThread, self)._message_subscribe( |
||||
|
partner_ids, subtype_ids) |
||||
|
else: |
||||
|
return super(MailThread, self)._message_subscribe( |
||||
|
partner_ids, subtype_ids) |
||||
|
|
||||
|
def _message_auto_subscribe(self, updated_values, |
||||
|
followers_existing_policy='skip'): |
||||
|
""" Handle auto subscription. Auto subscription is done based on two |
||||
|
main mechanisms |
||||
|
* using subtypes parent relationship. For example following a |
||||
|
parent record (i.e. project) with subtypes linked to child |
||||
|
records (i.e. task). See mail.message.subtype `` |
||||
|
_get_auto_subscription_subtypes``; |
||||
|
* calling _message_auto_subscribe_notify that returns |
||||
|
a list of partner to subscribe, as well as data about the |
||||
|
subtypes and notification to send. Base behavior is to |
||||
|
subscribe responsible and notify them; Adding |
||||
|
application-specific auto subscription should be done |
||||
|
by overriding``_message_auto_subscribe_followers``. |
||||
|
It should return structured data for new partner to subscribe, |
||||
|
with subtypes and eventual notification to perform. See that |
||||
|
method for more details. |
||||
|
:param updated_values: values modifying the record trigerring |
||||
|
auto subscription |
||||
|
""" |
||||
|
model_name = self.no_subscription() |
||||
|
if model_name: |
||||
|
for rec in self: |
||||
|
if rec._name not in model_name: |
||||
|
return super(MailThread, self)._message_auto_subscribe( |
||||
|
updated_values, followers_existing_policy) |
||||
|
else: |
||||
|
return super(MailThread, self)._message_auto_subscribe( |
||||
|
updated_values, followers_existing_policy) |
||||
|
|
||||
|
def _message_auto_subscribe_notify(self, partner_ids, template): |
||||
|
""" Notify new followers, using a template to render the content of the |
||||
|
notification message. Notifications pushed are done using the |
||||
|
standard |
||||
|
notification mechanism in mail.thread. It is inbox either email |
||||
|
depending on the partner state: no user (email, customer), share |
||||
|
user |
||||
|
(email, customer) or classic user (notification_type) |
||||
|
|
||||
|
:param partner_ids: IDs of partner to notify; |
||||
|
:param template: XML ID of template used for the notification; |
||||
|
""" |
||||
|
model_to_stop_subscription = self.no_subscription() |
||||
|
if model_to_stop_subscription: |
||||
|
for rec in self: |
||||
|
if rec._name not in model_to_stop_subscription: |
||||
|
return super(MailThread, self)._message_auto_subscribe_notify( |
||||
|
partner_ids, template) |
||||
|
else: |
||||
|
return super(MailThread, self)._message_auto_subscribe_notify( |
||||
|
partner_ids, template) |
||||
|
|
||||
|
def no_subscription(self): |
||||
|
"""This is used to return the model names to stop the automatic |
||||
|
subscription""" |
||||
|
subscription_models = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'no_automatic_subscription.subscription_models_ids') |
||||
|
if subscription_models: |
||||
|
subscription = subscription_models.replace('[', '') |
||||
|
subscription_change = subscription.replace(']', '') |
||||
|
subscription_models_ids = [] |
||||
|
for rec in subscription_change.split(','): |
||||
|
if int(rec): |
||||
|
model_subscription = self.env['ir.model'].browse(int(rec)) |
||||
|
subscription_models_ids.append(model_subscription.model) |
||||
|
return subscription_models_ids |
@ -0,0 +1,65 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from ast import literal_eval |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ResConfigSettings(models.TransientModel): |
||||
|
"""Adding new fields to settings to stop the automatic subscription of |
||||
|
customers""" |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
subscribe_recipients = fields.Boolean(string='Subscribe Recipients?', |
||||
|
default=False, |
||||
|
help="Do you want to subscribe the " |
||||
|
"recipients as followers") |
||||
|
subscription_models_ids = fields.Many2many('ir.model', |
||||
|
domain="[('is_mail_thread','=',True)]", |
||||
|
help="the model you want to" |
||||
|
" restrict the subscription") |
||||
|
|
||||
|
@api.model |
||||
|
def set_values(self): |
||||
|
"""Sets the values that entered to the settings""" |
||||
|
res = super(ResConfigSettings, self).set_values() |
||||
|
self.env['ir.config_parameter'].sudo().set_param( |
||||
|
'no_automatic_subscription.subscribe_recipients', |
||||
|
self.subscribe_recipients) |
||||
|
self.env['ir.config_parameter'].sudo().set_param( |
||||
|
'no_automatic_subscription.subscription_models_ids', |
||||
|
self.subscription_models_ids.ids) |
||||
|
return res |
||||
|
|
||||
|
def get_values(self): |
||||
|
"""Getting the values from the transient model""" |
||||
|
res = super(ResConfigSettings, self).get_values() |
||||
|
with_user = self.env['ir.config_parameter'].sudo() |
||||
|
subscription = with_user.get_param( |
||||
|
'no_automatic_subscription.subscription_models_ids') |
||||
|
subscribe_recipients = with_user.get_param( |
||||
|
'no_automatic_subscription.subscribe_recipients') |
||||
|
res.update( |
||||
|
subscription_models_ids=[(6, 0, literal_eval(subscription))] |
||||
|
if subscription else False, |
||||
|
subscribe_recipients=subscribe_recipients, |
||||
|
) |
||||
|
return res |
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 188 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 190 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 45 KiB |