Browse Source
[ADD] mail_edit v9
[ADD] mail_edit v9
[FIX] #5124 field namechange in v9 [FIX] v9 chatter [FIX] template fix fix [FIX] working versionpull/356/head
7 changed files with 50 additions and 60 deletions
-
1mail_edit/README.rst
-
1mail_edit/__init__.py
-
4mail_edit/__openerp__.py
-
5mail_edit/models/compose_message.py
-
80mail_edit/static/src/js/mail_edit.js
-
17mail_edit/static/src/xml/mail_edit.xml
-
2mail_edit/views/compose_message.xml
@ -1,4 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2016 Sunflower IT (http://sunflowerweb.nl) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
|
@ -1,50 +1,40 @@ |
|||
/* © 2014-2017 Sunflower IT <www.sunflowerweb.nl>*/ |
|||
odoo.define('mail_edit.thread', function(require) { |
|||
|
|||
"use strict"; |
|||
openerp.mail_edit = function (instance) { |
|||
var _t = instance.web._t; |
|||
instance.mail.ThreadMessage.include({ |
|||
bind_events: function () { |
|||
this._super.apply(this, arguments); |
|||
this.$('.oe_edit').on('click', this.on_message_edit); |
|||
this.$('.oe_delete').on('click', this.on_message_delete); |
|||
}, |
|||
|
|||
on_message_edit: function () { |
|||
var context = {}; |
|||
|
|||
// save the widget object in a var.
|
|||
var self = this; |
|||
"use strict"; |
|||
|
|||
// Get the action data
|
|||
var do_action = this.do_action; |
|||
var thread = require('mail.ChatThread'); |
|||
|
|||
this.rpc("/web/action/load", { |
|||
"action_id": "mail_edit.mail_edit_action", |
|||
}) |
|||
.done(function(action) { |
|||
action.res_id = self.id; |
|||
action.flags = { |
|||
action_buttons: true, |
|||
}; |
|||
action.context = context; |
|||
do_action(action, { |
|||
on_close: function () { |
|||
// reload view
|
|||
var parent = self.getParent().getParent().getParent().getParent() |
|||
if (typeof parent.model !== "undefined"){ |
|||
parent.reload(); |
|||
} |
|||
}, |
|||
}); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
instance.mail.MessageCommon.include({ |
|||
init: function (parent, datasets, options) { |
|||
this._super(parent, datasets, options); |
|||
this.is_superuser = datasets.is_superuser || false; |
|||
} |
|||
thread.include({ |
|||
init: function(){ |
|||
this._super.apply(this, arguments); |
|||
this.events['click .o_edit'] = function (event) { |
|||
var context = {}; |
|||
// save the widget object in a var.
|
|||
var self = this; |
|||
// Get the action data
|
|||
var message_id = $(event.currentTarget).data('message-id'); |
|||
var do_action = this.do_action; |
|||
this.rpc("/web/action/load", { |
|||
"action_id": "mail_edit.mail_edit_action", |
|||
}) |
|||
.done(function(action) { |
|||
action.res_id = message_id; |
|||
action.flags = { |
|||
action_buttons: true, |
|||
}; |
|||
action.context = context; |
|||
do_action(action, { |
|||
on_close: function () { |
|||
// reload view
|
|||
var parent = self.getParent().getParent().getParent() |
|||
if (typeof parent.model !== "undefined"){ |
|||
parent.reload(); |
|||
} |
|||
}, |
|||
}); |
|||
}); |
|||
}; |
|||
}, |
|||
}); |
|||
}; |
|||
}); |
@ -1,16 +1,15 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<template> |
|||
<t t-extend="mail.thread.message"> |
|||
<t t-jquery=".oe_msg_icons .oe_reply" t-operation="before"> |
|||
<t t-if="widget.is_author or widget.is_superuser"> |
|||
<span class="oe_edit"> |
|||
<a title="Edit Mail" class="oe_e">&</a> |
|||
<t t-extend="mail.ChatThread.Message"> |
|||
<t t-jquery='p.o_mail_info>span>i:first-child' t-operation="after"> |
|||
<span class="oe_edit"> |
|||
<t t-if="is_author or is_superuser" > |
|||
<i title="Edit Mail" class="fa fa-pencil-square-o o_edit" |
|||
t-att-data-message-id="message.id"> |
|||
</i> |
|||
</t> |
|||
</span> |
|||
<span class="oe_delete"> |
|||
<a title="Delete" class="oe_e">[</a> |
|||
</span> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue