Browse Source

[WIP] Send mail using internal mail wizard

pull/279/head
Peter Hahn 9 years ago
parent
commit
4f4b8d03e2
  1. 0
      web_widget_mail_send_odoo/__init__.py
  2. 26
      web_widget_mail_send_odoo/__openerp__.py
  3. 13
      web_widget_mail_send_odoo/assets.xml
  4. 1
      web_widget_mail_send_odoo/static/src/css/web_widget_mail_send_odoo.css
  5. 53
      web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js
  6. 8
      web_widget_mail_send_odoo/static/src/xml/web_widget_mail_send_odoo.xml

0
web_widget_mail_send_odoo/__init__.py

26
web_widget_mail_send_odoo/__openerp__.py

@ -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',
],
}

13
web_widget_mail_send_odoo/assets.xml

@ -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>

1
web_widget_mail_send_odoo/static/src/css/web_widget_mail_send_odoo.css

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

53
web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js

@ -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')
})()

8
web_widget_mail_send_odoo/static/src/xml/web_widget_mail_send_odoo.xml

@ -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>
Loading…
Cancel
Save