From 21b27fe6dde8c7a56fa08659ddf844fea2e37160 Mon Sep 17 00:00:00 2001 From: astirpe Date: Fri, 24 Jun 2016 17:20:46 +0200 Subject: [PATCH] [8.0][ADD] mail_opt_out_default addon --- mail_opt_out_default/README.rst | 76 ++++++++++++++++++++++ mail_opt_out_default/__init__.py | 5 ++ mail_opt_out_default/__openerp__.py | 17 +++++ mail_opt_out_default/models/__init__.py | 5 ++ mail_opt_out_default/models/res_partner.py | 13 ++++ 5 files changed, 116 insertions(+) create mode 100644 mail_opt_out_default/README.rst create mode 100644 mail_opt_out_default/__init__.py create mode 100644 mail_opt_out_default/__openerp__.py create mode 100644 mail_opt_out_default/models/__init__.py create mode 100644 mail_opt_out_default/models/res_partner.py diff --git a/mail_opt_out_default/README.rst b/mail_opt_out_default/README.rst new file mode 100644 index 00000000..8d011024 --- /dev/null +++ b/mail_opt_out_default/README.rst @@ -0,0 +1,76 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +==================================== +Restrict automatic emails to partner +==================================== + +This module sets the default value of the field "Opt-Out" to True while creating a Partner. +In standard Odoo, that field is defined in the module email_template and its default value is False. + +As stated in the help comment for the field (Odoo code, module email_template): +` + help="If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign. " +` + +By installing this module, partners by default will not receive marketing emails or other kind of automated emails. + + +Configuration +============= + +To configure this module, you need to: + +#. No configuration needed. + + +Usage +===== + +To use this module, you need to: + +#. Create a Partner + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/205/8.0 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Andrea Stirpe + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. + diff --git a/mail_opt_out_default/__init__.py b/mail_opt_out_default/__init__.py new file mode 100644 index 00000000..0ff08c3b --- /dev/null +++ b/mail_opt_out_default/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 ONESTEiN BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mail_opt_out_default/__openerp__.py b/mail_opt_out_default/__openerp__.py new file mode 100644 index 00000000..1ffce3da --- /dev/null +++ b/mail_opt_out_default/__openerp__.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# © 2016 ONESTEiN BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Restrict automatic emails to partner', + 'images': [], + 'summary': 'Set field Opt-Out as true by default while creating a partner', + 'license': 'AGPL-3', + 'author': 'ONESTEiN BV, Odoo Community Association (OCA)', + 'website': 'http://www.onestein.eu', + 'category': 'Marketing', + 'version': '8.0.1.0.0', + 'depends': [ + 'email_template', + ], +} diff --git a/mail_opt_out_default/models/__init__.py b/mail_opt_out_default/models/__init__.py new file mode 100644 index 00000000..5f1f11c2 --- /dev/null +++ b/mail_opt_out_default/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 ONESTEiN BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_partner diff --git a/mail_opt_out_default/models/res_partner.py b/mail_opt_out_default/models/res_partner.py new file mode 100644 index 00000000..ade7636f --- /dev/null +++ b/mail_opt_out_default/models/res_partner.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# © 2016 ONESTEiN BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + _defaults = { + 'opt_out': True, + }