[IMP] mail: chatter composition form: added a reinitialization of the widget.
bzr revid: tde@openerp.com-20120716135403-xvgc8ew0c62hrv3s
This commit is contained in:
@@ -291,6 +291,21 @@ openerp.mail = function(session) {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Reinitialize the widget field values to the default values. The
|
||||
* purpose is to avoid to destroy and re-build a form view. Default
|
||||
* values are therefore given as for an onchange. */
|
||||
reinit: function() {
|
||||
var self = this;
|
||||
if (! this.form_view) return;
|
||||
// debugger
|
||||
var call_defer = this.ds_compose.call('default_get', [['subject', 'body_text', 'body_html', 'dest_partner_ids'], this.ds_compose.get_context()]).then(
|
||||
function (result) {
|
||||
self.form_view.on_processed_onchange({'value': result}, []);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Override-hack of do_action: clean the form */
|
||||
do_action: function(action, on_close) {
|
||||
@@ -496,6 +511,8 @@ openerp.mail = function(session) {
|
||||
* in the composition form. */
|
||||
do_action: function(action, on_close) {
|
||||
this.init_comments();
|
||||
if (this.compose_message_widget) {
|
||||
this.compose_message_widget.reinit(); }
|
||||
return this._super(action, on_close);
|
||||
},
|
||||
|
||||
@@ -946,6 +963,8 @@ openerp.mail = function(session) {
|
||||
* in the composition form. */
|
||||
do_action: function(action, on_close) {
|
||||
this.init_and_fetch_comments();
|
||||
if (this.compose_message_widget) {
|
||||
this.compose_message_widget.reinit(); }
|
||||
return this._super(action, on_close);
|
||||
},
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ class mail_compose_message(osv.TransientModel):
|
||||
if not result.get('email_from'):
|
||||
current_user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
result['email_from'] = current_user.user_email or False
|
||||
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
@@ -137,7 +136,8 @@ class mail_compose_message(osv.TransientModel):
|
||||
'model': model,
|
||||
'res_id': res_id,
|
||||
'email_from': user.user_email or tools.config.get('email_from', False),
|
||||
'body_html': '',
|
||||
'body_html': False,
|
||||
'body_text': False,
|
||||
})
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user