[IMP][mail_attach_existing_attachment] Change module name

This commit is contained in:
Adrien Peiffer (ACSONE) 2015-08-17 10:44:04 +02:00 committed by Alvaro
parent df975ff973
commit 941809d36f
12 changed files with 309 additions and 0 deletions

View File

@ -0,0 +1,68 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Mail Attach Existing Attachment
===============================
This module was written to add the possibility to add attachments located on
the object by sending it by email with the mail compose message wizard
Installation
============
To install this module, you need to:
* Click on install
Usage
=====
To configure this module, you need to:
* Adding some attachments on an object
.. figure:: static/description/attachment.png
:alt: Attachment on purchase order
* Then, by sending the object via email, you can select the attachment added earlier
.. figure:: static/description/ex_mail_compose_message.png
:alt: Sends the Purchase Order by email
.. 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
Known issues / Roadmap
======================
* The module only allows the addition of attachments linked to the object.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/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
`here <https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Adrien Peiffer <adrien.peiffer@acsone.eu>
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://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 http://odoo-community.org.

View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import wizard

View File

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mail_attach_existing_attachment,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mail_attach_existing_attachment is free software:
# you can redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# mail_attach_existing_attachment 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with mail_attach_existing_attachment.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "Mail Attach Existing Attachment",
'summary': """
Adding attachment on the object by sending this one""",
'author': "ACSONE SA/NV,Odoo Community Association (OCA)",
'website': "http://acsone.eu",
'category': 'Social Network',
'version': '8.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'mail',
'document',
],
'data': [
'wizard/mail_compose_message_view.xml',
],
}

View File

@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_attach_existing_attachment
#
# Translators:
# Armando Vulcano Junior <vulcano@uol.com.br>, 2015
msgid ""
msgstr ""
"Project-Id-Version: social (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-09-30 16:56+0000\n"
"PO-Revision-Date: 2015-09-18 19:58+0000\n"
"Last-Translator: Armando Vulcano Junior <vulcano@uol.com.br>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-social-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: mail_attach_existing_attachment
#: field:mail.compose.message,object_attachment_ids:0
msgid "Attachments"
msgstr "Anexos"
#. module: mail_attach_existing_attachment
#: field:mail.compose.message,can_attach_attachment:0
msgid "Can Attach Attachment"
msgstr "Pode Anexar Anexo"
#. module: mail_attach_existing_attachment
#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message
msgid "Email composition wizard"
msgstr "Assistente de Composição de Email"

View File

@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_attach_existing_attachment
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
msgid ""
msgstr ""
"Project-Id-Version: social (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-09-04 14:42+0000\n"
"PO-Revision-Date: 2015-09-07 14:25+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: mail_attach_existing_attachment
#: field:mail.compose.message,object_attachment_ids:0
msgid "Attachments"
msgstr "Priponke"
#. module: mail_attach_existing_attachment
#: field:mail.compose.message,can_attach_attachment:0
msgid "Can Attach Attachment"
msgstr "Lahko pripenja priponke"
#. module: mail_attach_existing_attachment
#: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message
msgid "Email composition wizard"
msgstr "Čarovnik za sestavljanje e-pošte"

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import test_mail_attach_existing_attachment

View File

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mail_attach_existing_attachment,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mail_attach_existing_attachment is free software:
# you can redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# mail_attach_existing_attachment 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with mail_attach_existing_attachment.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.tests import common
class TestAttachExistingAttachment(common.TransactionCase):
def setUp(self):
super(TestAttachExistingAttachment, self).setUp()
self.partner_obj = self.env['res.partner']
self.partner_01 = self.env.ref('base.res_partner_1')
def test_send_email_attachment(self):
attach1 = self.env['ir.attachment'].create({
'name': 'Attach1', 'datas_fname': 'Attach1',
'datas': 'bWlncmF0aW9uIHRlc3Q=',
'res_model': 'res.partner', 'res_id': self.partner_01.id})
vals = {'model': 'res.partner',
'partner_ids': [(6, 0, [self.partner_01.id])],
'res_id': self.partner_01.id,
'object_attachment_ids': [(6, 0, [attach1.id])]
}
mail = self.env['mail.compose.message'].create(vals)
values = mail.get_mail_values(mail, [self.partner_01.id])
self.assertTrue(attach1.id in
values[self.partner_01.id]['attachment_ids'])

View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import mail_compose_message

View File

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mail_attach_existing_attachment,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mail_attach_existing_attachment is free software:
# you can redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# mail_attach_existing_attachment 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with mail_attach_existing_attachment.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api
class MailComposeMessage(models.TransientModel):
_inherit = 'mail.compose.message'
@api.model
def default_get(self, fields_list):
res = super(MailComposeMessage, self).default_get(fields_list)
if res.get('res_id') and res.get('model') and \
res.get('composition_mode', '') != 'mass_mail' and\
not res.get('can_attach_attachment'):
res['can_attach_attachment'] = True
return res
can_attach_attachment = fields.Boolean(string='Can Attach Attachment')
object_attachment_ids = fields.Many2many(
comodel_name='ir.attachment',
relation='mail_compose_message_ir_attachments_object_rel',
column1='wizard_id', column2='attachment_id', string='Attachments')
@api.model
def get_mail_values(self, wizard, res_ids):
res = super(MailComposeMessage, self).get_mail_values(wizard, res_ids)
if wizard.object_attachment_ids.ids and wizard.model and\
len(res_ids) == 1:
for res_id in res_ids:
if not res[res_id].get('attachment_ids'):
res[res_id]['attachment_ids'] = []
res[res_id]['attachment_ids'].extend(
wizard.object_attachment_ids.ids)
return res

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record model="ir.ui.view" id="email_compose_message_wizard_inherit_form">
<field name="name">mail.compose.message.form (mail_attach_existing_attachment)</field>
<field name="model">mail.compose.message</field>
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='attachment_ids']" position="after">
<field name="can_attach_attachment" invisible="1"/>
<div attrs="{'invisible': [('can_attach_attachment', '=', False)]}">
<br />
<field name="object_attachment_ids" widget="many2many_checkboxes" domain="[('res_model', '=', model), ('res_id', '=', res_id)]" />
</div>
</xpath>
</field>
</record>
</data>
</openerp>