3
0
Fork 0

[WIP] Send mail using internal mail wizard

8.0
Peter Hahn 2015-12-22 14:28:20 +01:00
parent f988afd99e
commit 4f4b8d03e2
6 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# © 2015 initOS GmbH (<http://www.initos.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Mail open internally',
'summary': 'Open mail in new window',
'version': '8.0.1.0.0',
"category": "Social Network",
'website': 'https://odoo-community.org',
'author': 'initOS GmbH, Odoo Community Association (OCA)',
"license": "AGPL-3",
'application': False,
'installable': True,
'auto_install': False,
'depends': [
'web',
'mail',
],
'data': [
'assets.xml',
],
'qweb': [
'static/src/xml/web_widget_mail_send_odoo.xml',
],
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="custom bar assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_widget_mail_send_odoo/static/src/css/web_widget_mail_send_odoo.css"/>
<script type="text/javascript" src="/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js"/>
</xpath>
</template>
</data>
</openerp>

View File

@ -0,0 +1 @@
.openerp .oe_form .oe_form_field_email_intern input,

View File

@ -0,0 +1,53 @@
/* © 2015 initOS GmbH (<http://www.initos.com>)
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
(function() {
var instance = openerp;
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
instance.web.form.FieldEmailIntern = instance.web.form.FieldChar.extend({
template: 'FieldEmailIntern',
initialize_content: function() {
this._super();
var $button = this.$el.find('button');
$button.click(this.on_button_clicked);
this.setupFocus($button);
},
render_value: function() {
var self = this;
if (!this.get("effective_readonly")) {
this._super();
} else {
this.$el.find('a')
//.attr('href', 'nix:' + this.get('value'))
.removeAttr('href')
.text(this.get('value') || '')
.unbind('click')
.click(function () {
self.do_action('mail.action_email_compose_message_wizard',{
additional_context:{
default_partner_ids: self.field_manager.get_selected_ids()
}})
});
}
},
on_button_clicked: function() {
if (!this.get('value') || !this.is_syntax_valid()) {
this.do_warn(_t("E-mail Error"), _t("Can't send email to invalid e-mail address"));
} else {
// action to open: mail.action_email_compose_message_wizard
//location.href = 'mailto:' + this.get('value');
self.do_action('mail.action_email_compose_message_wizard')
}
}
});
instance.web.form.widgets.add('email', 'instance.web.form.FieldEmailIntern')
//instance.web.form.widgets.add('email-intern', 'instance.web.form.FieldEmailIntern')
})()

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="FieldEmailIntern" t-extend="FieldEmail">
<t t-jquery="span:first">
this.removeClass('oe_form_field_email').addClass('oe_form_field_email_intern');
</t>
</t>
</templates>