[TMP] mail.js: tmp update, will be probably discarded.

bzr revid: tde@openerp.com-20120614084033-yx65ehk81s2o99il
This commit is contained in:
Thibault Delavallée 2012-06-14 10:40:33 +02:00
parent 5ddea612b4
commit 027f8e7fb7
4 changed files with 115 additions and 6 deletions

View File

@ -651,9 +651,9 @@ class mail_thread(osv.Model):
return self.message_append_dict(cr, uid, ids, msg_dict, context=context)
def message_thread_followers(self, cr, uid, ids, context=None):
"""Returns a list of email addresses of the people following
this thread, including the sender of each mail, and the
people who were in CC of the messages, if any.
""" Returns a list of email addresses of the people following
this thread, including the sender of each mail, and the
people who were in CC of the messages, if any.
"""
res = {}
if isinstance(ids, (str, int, long)):
@ -807,9 +807,9 @@ class mail_thread(osv.Model):
""" Returns the current document followers. Basically this method
checks in mail.subscription for entries with matching res_model,
res_id.
:param get_ids: if set to True, return the ids of users; if set
to False, returns the result of a read in res.users
This method can be overriden to add implicit subscribers, such
as project managers, by adding their user_id to the list of
ids returned by this method.
"""
subscr_obj = self.pool.get('mail.subscription')
subscr_ids = subscr_obj.search(cr, uid, ['&', ('res_model', '=', self._name), ('res_id', 'in', ids)], context=context)

View File

@ -20,6 +20,55 @@ openerp.mail = function(session) {
*/
var mail_msg_struct = mail.chatter_message_structure = {}; // TODO: USE IT OR NOT :)
/**
* ------------------------------------------------------------
* ComposeMessage widget
* ------------------------------------------------------------
*
* This widget handles the display of a form to compose a new message.
*/
/* Add ComposeMessage widget to registry */
session.web.form.widgets.add('compose_message', 'openerp.mail.ComposeMessage');
/* ComposeMessage is an extension of a Widget */
mail.compose_message = session.web.Widget.extend({
template: 'mail.compose_message',
init: function(parent, params) {
this._super(parent);
console.log(params);
this.ds_compose = new session.web.DataSet(this, 'mail.compose.message');
this.form_view = new session.web.FormView(this, this.ds_compose, false, {
action_buttons: false,
pager: false,
initial_mode: 'edit',
}
);
},
start: function(parent, params) {
this._super.apply(this, arguments);
console.log('start');
console.log(this);
var node = this.$element.find('div.caca');
var node = this.$element.find('p');
console.log(node);
var done = this.form_view.appendTo(node);
return done;
},
destroy: function(parent, params) {
this._super.apply(this, arguments);
},
}),
/**
* Thread widget: this widget handles the display of a thread of
* messages. The [thread_level] parameter sets the thread level number:
@ -92,6 +141,11 @@ openerp.mail = function(session) {
else var display_done = this.init_comments();
// customize display
$.when(display_done).then(this.proxy('do_customize_display'));
// add form view
this.caca = new mail.compose_message();
this.caca.appendTo(this.$element.find('div.oe_mail_thread_act'));
return display_done
},

View File

@ -44,6 +44,11 @@
</div>
</div>
<t t-name="mail.compose_message">
<div class="caca"><p>cacaproutboudin</p>
</div>
</t>
<ul t-name="Thread" class="oe_mail oe_mail_thread">
<div class="oe_mail_thread_act">
<img class="oe_mail_msg_image oe_left" alt="User img"/>

View File

@ -51,6 +51,56 @@
</field>
</record>
<record model="ir.ui.view" id="email_compose_message_wizard_form">
<field name="name">mail.compose.message.form</field>
<field name="model">mail.compose.message</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Compose Email">
<group col="6" colspan="4">
<!--
<field name="model" invisible="1"/>
<field name="res_id" invisible="1"/>
-->
<field name='filter_id' invisible="context.get('active_model',False)"/>
<newline/>
<group colspan="4" col="4">
<field name="email_from" colspan="4" required="1"/>
<field name="email_to" colspan="4" required="1"/>
<field name="email_cc" colspan="4"/>
<field name="email_bcc" colspan="4"/>
<field name="reply_to" colspan="4"/>
<field name="subject" colspan="4" widget="char" size="512"/>
</group>
<newline/>
<separator string="Debug information" colspan="6"/>
<field name="model"/>
<field name="res_id"/>
<newline/>
<field name="references"/>
<field name="message_id"/>
<!--
<field name="references" invisible="1"/>
<field name="message_id" invisible="1"/>
-->
</group>
<notebook colspan="4">
<page string="Body">
<field name="body_text" colspan="4" nolabel="1" height="300" width="300"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" nolabel="1"/>
</page>
</notebook>
<group col="4" colspan="4">
<label string="" name="placeholder" colspan="1"/>
<button icon="gtk-close" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="send_mail" string="Send" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_email_compose_message_wizard" model="ir.actions.act_window">
<field name="name">Compose Email</field>
<field name="res_model">mail.compose.message</field>