[IMP] mail.js: included form view to compose a message now basically working.

bzr revid: tde@openerp.com-20120614114418-x1no0ey51xmczta9
This commit is contained in:
Thibault Delavallée 2012-06-14 13:44:18 +02:00
parent 9f1a2fae92
commit 3e47bfeed0
2 changed files with 15 additions and 41 deletions

View File

@ -41,24 +41,29 @@ openerp.mail = function(session) {
init: function(parent, params) {
this._super(parent);
console.log(params);
this.ds_compose = new session.web.DataSet(this, 'mail.compose.message');
this.ds_compose = new session.web.DataSetSearch(this, 'mail.compose.message');
this.form_view = new session.web.FormView(this, this.ds_compose, false, {
action_buttons: false,
pager: false,
/*action_buttons: false,
pager: false,*/
initial_mode: 'edit',
}
);
this.form_view.on_button_cancel = function() {
console.log('cacaprout');
}
},
start: function(parent, params) {
var self = this;
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;
return $.when(this.form_view.appendTo(node)).pipe(function() {
self.form_view.do_show();
});
},
destroy: function(parent, params) {

View File

@ -51,48 +51,17 @@
</field>
</record>
<record model="ir.ui.view" id="email_compose_message_wizard_form">
<record model="ir.ui.view" id="email_compose_message_wizard_form2">
<field name="name">mail.compose.message.form</field>
<field name="model">mail.compose.message</field>
<field name="priority">1</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)"/>
<group col="4">
<field name="subject" colspan="4" widget="char" size="512"/>
<field name="body_text" colspan="4" nolabel="1" height="300" width="300"/>
<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"/>