mirror of https://github.com/OCA/social.git
[MIG] fetch_thread_default: Migration to 11.0
parent
d30e1f9042
commit
add4bd178c
|
@ -1,11 +1,30 @@
|
||||||
.. 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
|
|
||||||
|
|
||||||
===================================
|
===================================
|
||||||
Default Thread For Unbounded Emails
|
Default Thread For Unbounded Emails
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
|
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
|
:target: https://odoo-community.org/page/development-status
|
||||||
|
:alt: Beta
|
||||||
|
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||||
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
|
:alt: License: AGPL-3
|
||||||
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
||||||
|
:target: https://github.com/OCA/social/tree/11.0/fetchmail_thread_default
|
||||||
|
:alt: OCA/social
|
||||||
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
|
:target: https://translation.odoo-community.org/projects/social-11-0/social-11-0-fetchmail_thread_default
|
||||||
|
:alt: Translate me on Weblate
|
||||||
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
|
:target: https://runbot.odoo-community.org/runbot/205/11.0
|
||||||
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
This module extends the functionality of mail fetching to support choosing a
|
This module extends the functionality of mail fetching to support choosing a
|
||||||
mail thread that acts as a mail sink and gathers all mail messages that Odoo
|
mail thread that acts as a mail sink and gathers all mail messages that Odoo
|
||||||
does not know where to put.
|
does not know where to put.
|
||||||
|
@ -23,6 +42,11 @@ Here we come to the rescue. This simple addons adds almost none dependencies
|
||||||
and allows you to direct those mails somewhere you can handle or ignore at
|
and allows you to direct those mails somewhere you can handle or ignore at
|
||||||
wish.
|
wish.
|
||||||
|
|
||||||
|
**Table of contents**
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
@ -45,49 +69,45 @@ To use this module, you need to:
|
||||||
#. You will be notified when a new unbound email lands in that thread.
|
#. You will be notified when a new unbound email lands in that thread.
|
||||||
#. Do what you want with it.
|
#. Do what you want with it.
|
||||||
|
|
||||||
.. 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/9.0
|
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Bugs are tracked on `GitHub Issues
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
||||||
<https://github.com/OCA/social/issues>`_. In case of trouble, please
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
check there if your issue has already been reported. If you spotted it first,
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
help us smash it by providing detailed and welcomed feedback.
|
`feedback <https://github.com/OCA/social/issues/new?body=module:%20fetchmail_thread_default%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Images
|
Authors
|
||||||
------
|
~~~~~~~
|
||||||
|
|
||||||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
|
* Tecnativa
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
------------
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
* Jairo Llopis <jairo.llopis@tecnativa.com>
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
Funders
|
* Jairo Llopis
|
||||||
-------
|
* David Vidal
|
||||||
|
|
||||||
The development of this module has been financially supported by:
|
Maintainers
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_.
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
Maintainer
|
|
||||||
----------
|
|
||||||
|
|
||||||
.. image:: https://odoo-community.org/logo.png
|
.. image:: https://odoo-community.org/logo.png
|
||||||
:alt: Odoo Community Association
|
:alt: Odoo Community Association
|
||||||
:target: https://odoo-community.org
|
:target: https://odoo-community.org
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
|
||||||
|
|
||||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
To contribute to this module, please visit https://odoo-community.org.
|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/11.0/fetchmail_thread_default>`_ project on GitHub.
|
||||||
|
|
||||||
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -1,5 +1 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
{
|
{
|
||||||
"name": "Default Thread For Unbounded Emails",
|
"name": "Default Thread For Unbounded Emails",
|
||||||
"summary": "Post unkonwn messages to an existing thread",
|
"summary": "Post unkonwn messages to an existing thread",
|
||||||
"version": "9.0.1.0.0",
|
"version": "11.0.1.0.0",
|
||||||
"category": "Discuss",
|
"category": "Discuss",
|
||||||
"website": "https://www.tecnativa.com/",
|
"website": "https://www.github.com/social",
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"application": False,
|
"application": False,
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
<!-- Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
|
@ -1,6 +1,2 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
|
|
||||||
from . import fetchmail_server
|
from . import fetchmail_server
|
||||||
from . import mail_thread
|
from . import mail_thread
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import api, fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class FetchmailServer(models.Model):
|
class FetchmailServer(models.Model):
|
||||||
|
@ -29,17 +28,12 @@ class FetchmailServer(models.Model):
|
||||||
return [(m.model, m.name) for m in models
|
return [(m.model, m.name) for m in models
|
||||||
if m.model in self.env and getattr(self.env[m.model], "_auto")]
|
if m.model in self.env and getattr(self.env[m.model], "_auto")]
|
||||||
|
|
||||||
# TODO New api on v10+
|
@api.onchange('type', 'is_ssl', 'object_id')
|
||||||
# pylint: disable=old-api7-method-defined
|
def onchange_server_type(self):
|
||||||
def onchange_server_type(self, cr, uid, ids, server_type=False, ssl=False,
|
|
||||||
object_id=False):
|
|
||||||
"""Remove :attr:`default_thread_id` if there is :attr:`object_id`."""
|
"""Remove :attr:`default_thread_id` if there is :attr:`object_id`."""
|
||||||
result = super(FetchmailServer, self).onchange_server_type(
|
if self.object_id:
|
||||||
cr, uid, ids, server_type, ssl, object_id,
|
self.default_thread_id = False
|
||||||
)
|
return super(FetchmailServer, self).onchange_server_type()
|
||||||
if object_id:
|
|
||||||
result["value"]["default_thread_id"] = False
|
|
||||||
return result
|
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.onchange("default_thread_id")
|
@api.onchange("default_thread_id")
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import api, models
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
class MailThread(models.AbstractModel):
|
class MailThread(models.AbstractModel):
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
To configure this module, you need to:
|
||||||
|
|
||||||
|
#. Go to *Settings > General Settings > Configure the incoming email gateway*.
|
||||||
|
#. Create or edit a record.
|
||||||
|
#. Configure properly.
|
||||||
|
#. Under *Default mail thread*, choose a model and record.
|
||||||
|
|
||||||
|
Tip: if you do not know what to choose, we suggest you to use a mail
|
||||||
|
channel.
|
|
@ -0,0 +1,4 @@
|
||||||
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
|
* Jairo Llopis
|
||||||
|
* David Vidal
|
|
@ -0,0 +1,16 @@
|
||||||
|
This module extends the functionality of mail fetching to support choosing a
|
||||||
|
mail thread that acts as a mail sink and gathers all mail messages that Odoo
|
||||||
|
does not know where to put.
|
||||||
|
|
||||||
|
Dangling emails are really a problem because if you do not care about them,
|
||||||
|
SPAM can enter your inbox and keep increasing fetchmail process network quota
|
||||||
|
because Odoo would gather them every time it runs the fetchmail process.
|
||||||
|
|
||||||
|
Before this, your only choice was to create a new record for those unbounded
|
||||||
|
emails. That could be useful under some circumstances, like creating a
|
||||||
|
``crm.lead`` for them, but what happens if you do not want to have lots of
|
||||||
|
spammy leads? Or if you do not need Odoo's CRM at all?
|
||||||
|
|
||||||
|
Here we come to the rescue. This simple addons adds almost none dependencies
|
||||||
|
and allows you to direct those mails somewhere you can handle or ignore at
|
||||||
|
wish.
|
|
@ -0,0 +1,5 @@
|
||||||
|
To use this module, you need to:
|
||||||
|
|
||||||
|
#. Subscribe to the thread you chose as the *Default mail thread*.
|
||||||
|
#. You will be notified when a new unbound email lands in that thread.
|
||||||
|
#. Do what you want with it.
|
|
@ -1,5 +1 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
|
|
||||||
from . import test_fetchmail
|
from . import test_fetchmail
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
# Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp.addons.mail.tests.test_mail_gateway import MAIL_TEMPLATE
|
from odoo.addons.mail.tests.test_mail_gateway import MAIL_TEMPLATE
|
||||||
from openerp.tests.common import SavepointCase
|
from odoo.tests.common import SavepointCase
|
||||||
from openerp.tools import mute_logger
|
from odoo.tools import mute_logger
|
||||||
|
|
||||||
|
|
||||||
class FetchmailCase(SavepointCase):
|
class FetchmailCase(SavepointCase):
|
||||||
|
@ -22,10 +21,9 @@ class FetchmailCase(SavepointCase):
|
||||||
|
|
||||||
def test_emptying_default_thread(self):
|
def test_emptying_default_thread(self):
|
||||||
"""Choosing an ``object_id`` empties ``default_thread_id``."""
|
"""Choosing an ``object_id`` empties ``default_thread_id``."""
|
||||||
self.assertEqual(
|
self.server.write({'object_id': 1})
|
||||||
self.server.onchange_server_type(object_id=1)
|
self.server.onchange_server_type()
|
||||||
["value"]["default_thread_id"],
|
self.assertFalse(self.server.default_thread_id)
|
||||||
False)
|
|
||||||
|
|
||||||
def test_emptying_object(self):
|
def test_emptying_object(self):
|
||||||
"""Choosing a ``default_thread_id`` empties ``object_id``."""
|
"""Choosing a ``default_thread_id`` empties ``object_id``."""
|
||||||
|
@ -33,7 +31,7 @@ class FetchmailCase(SavepointCase):
|
||||||
self.server._onchange_remove_object_id()
|
self.server._onchange_remove_object_id()
|
||||||
self.assertFalse(self.server.object_id)
|
self.assertFalse(self.server.object_id)
|
||||||
|
|
||||||
@mute_logger('openerp.addons.mail.models.mail_thread', 'openerp.models')
|
@mute_logger('odoo.addons.mail.models.mail_thread', 'odoo.models')
|
||||||
def test_unbound_incoming_email(self):
|
def test_unbound_incoming_email(self):
|
||||||
"""An unbound incoming email gets posted to the sink."""
|
"""An unbound incoming email gets posted to the sink."""
|
||||||
# Imitate what self.server.feth_mail() would do
|
# Imitate what self.server.feth_mail() would do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
|
<!-- Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
Loading…
Reference in New Issue