Browse Source

[MIG] fetchmail_notify_error_to_sender: Migration to 11.0

pull/1306/head
HaiDD 7 years ago
committed by Pedro M. Baeza
parent
commit
2839a1d3c7
  1. 3
      fetchmail_notify_error_to_sender/README.rst
  2. 3
      fetchmail_notify_error_to_sender/__init__.py
  3. 7
      fetchmail_notify_error_to_sender/__manifest__.py
  4. 42
      fetchmail_notify_error_to_sender/data/email_template_data.xml
  5. 2
      fetchmail_notify_error_to_sender/models/__init__.py
  6. 4
      fetchmail_notify_error_to_sender/models/fetchmail.py
  7. 2
      fetchmail_notify_error_to_sender/models/mail_thread.py
  8. 18
      fetchmail_notify_error_to_sender/views/fetchmail_view.xml

3
fetchmail_notify_error_to_sender/README.rst

@ -35,7 +35,7 @@ Usage
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
:target: https://runbot.odoo-community.org/runbot/149/11.0
Bug Tracker
===========
@ -58,6 +58,7 @@ Contributors
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Miquel Raïch <miquel.raich@eficent.com> (migration to v9 and v10)
* Hai Dinh <haidd.uit@gmail.com> (migration to V11)
Maintainer
----------

3
fetchmail_notify_error_to_sender/__init__.py

@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# Copyright 2017 Eficent <http://www.eficent.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

7
fetchmail_notify_error_to_sender/__manifest__.py

@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# Copyright 2017 Eficent <http://www.eficent.com>
# Copyright 2018 Hai Dinh <haidd.uit@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Fetchmail Notify Error to Sender',
'summary': 'If fetching mails gives error, send an email to sender',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'Tools',
'author': "Agile Business Group,Eficent,Odoo Community Association (OCA)",
'author':
"Agile Business Group,Eficent,Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/server-tools',
'license': 'AGPL-3',
'depends': [

42
fetchmail_notify_error_to_sender/data/email_template_data.xml

@ -1,24 +1,24 @@
<?xml version="1.0" ?>
<odoo noupdate="1">
<!--Email template -->
<record id="email_template_error_notice" model="mail.template">
<field name="name">Fetchmail - error notice</field>
<field name="email_from">${ctx.get('sender_message').get('to')|safe}</field>
<field name="email_to">${ctx.get('sender_message').get('from')|safe}</field>
<field name="subject">Receiving error with: ${ctx.get('sender_message').get('subject')|safe}</field>
<field name="model_id" ref="fetchmail.model_fetchmail_server"/>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="True"/>
<field name="lang">${ctx.get('lang')}</field>
<field name="body_html"><![CDATA[
<div>
<p>Hello ${ctx.get('sender_message').get('from')},</p>
<p>we got a problem with your email: <i>${ctx.get('sender_message').get('subject')}</i></p>
<p>Maybe you used a wrong recipient address?</p>
<p><br/></p>
<p>Technical details:</p>
<p><i>${ctx.get('route_exception').message}</i></p>
</div>
]]></field>
</record>
<!--Email template -->
<record id="email_template_error_notice" model="mail.template">
<field name="name">Fetchmail - error notice</field>
<field name="email_from">${ctx.get('sender_message').get('to')|safe}</field>
<field name="email_to">${ctx.get('sender_message').get('from')|safe}</field>
<field name="subject">Receiving error with: ${ctx.get('sender_message').get('subject')|safe}</field>
<field name="model_id" ref="fetchmail.model_fetchmail_server"/>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="True"/>
<field name="lang">${ctx.get('lang')}</field>
<field name="body_html"><![CDATA[
<div>
<p>Hello ${ctx.get('sender_message').get('from')},</p>
<p>we got a problem with your email: <i>${ctx.get('sender_message').get('subject')}</i></p>
<p>Maybe you used a wrong recipient address?</p>
<p><br/></p>
<p>Technical details:</p>
<p><i>${ctx.get('route_exception').message}</i></p>
</div>
]]></field>
</record>
</odoo>

2
fetchmail_notify_error_to_sender/models/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent <http://www.eficent.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import fetchmail

4
fetchmail_notify_error_to_sender/models/fetchmail.py

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# Copyright 2017 Eficent <http://www.eficent.com>
# Copyright 2018 Hai Dinh <haidd.uit@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class FetchmailServer(models.Model):
_inherit = 'fetchmail.server'
error_notice_template_id = fields.Many2one(
'mail.template', string="Error notice template",
help="Set here the template to use to send notice to sender when "

2
fetchmail_notify_error_to_sender/models/mail_thread.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# Copyright 2017 Eficent <http://www.eficent.com>
# Copyright 2018 Hai Dinh <haidd.uit@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models

18
fetchmail_notify_error_to_sender/views/fetchmail_view.xml

@ -1,13 +1,13 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="view_email_server_form">
<field name="name">fetchmail.server.form</field>
<field name="model">fetchmail.server</field>
<field name="inherit_id" ref="fetchmail.view_email_server_form"/>
<field name="arch" type="xml">
<field name="active" position="after">
<field name="error_notice_template_id"/>
</field>
<record model="ir.ui.view" id="view_email_server_form">
<field name="name">fetchmail.server.form</field>
<field name="model">fetchmail.server</field>
<field name="inherit_id" ref="fetchmail.view_email_server_form"/>
<field name="arch" type="xml">
<field name="active" position="after">
<field name="error_notice_template_id"/>
</field>
</record>
</field>
</record>
</odoo>
Loading…
Cancel
Save