summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/form_renderer.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-11-28 15:25:20 +0100
committerMartin Geubelle <mge@odoo.com>2017-11-29 11:47:44 +0100
commite63c550ed1674884fd15bb2acfe3d0c445c2a76c (patch)
tree89ac5aa06ced7b231ae284ac9b27a66047e7c4e5 /addons/mail/static/src/js/form_renderer.js
parent0d48056d63286abd364e041b038c32fb1f648039 (diff)
[FIX] mail: display chatter inside the sheet
Before this revision, it was not possible to display a chatter inside a <sheet>. As the chatter is reused (when switching in edit, records, etc.), it is detached (to keep its handlers) before updating the form $el. The problem here is that the chatter was detached in `_updateView` from `$form.contents()` where the chatter is a root element ; when setting the form view html, the chatter was thus still present. This was thus only working correctly if the chatter was a direct child of <form>. To keep it displayed in all cases, we now detach it at the chatter node rendering. Closes #20032
Diffstat (limited to 'addons/mail/static/src/js/form_renderer.js')
-rw-r--r--addons/mail/static/src/js/form_renderer.js25
1 files changed, 9 insertions, 16 deletions
diff --git a/addons/mail/static/src/js/form_renderer.js b/addons/mail/static/src/js/form_renderer.js
index 4a0d98da4df..22437a8c18f 100644
--- a/addons/mail/static/src/js/form_renderer.js
+++ b/addons/mail/static/src/js/form_renderer.js
@@ -53,6 +53,15 @@ FormRenderer.include({
*/
_renderNode: function (node) {
if (node.tag === 'div' && node.attrs.class === 'oe_chatter') {
+ if (this.chatter) {
+ // Detach the chatter before updating the $el.
+ // This is important because if the view is now in create mode
+ // (edit mode with no res_id), the chatter will be removed from
+ // the DOM, and its handlers will be unbound. By detaching it
+ // beforehand, we ensure to keep its handlers alive so that if
+ // it is re-appended later, everything will still work properly
+ this.chatter.$el.detach();
+ }
if (this.mode === 'edit' && !this.state.data.id) {
// there is no chatter in create mode
var $div = $('<div>');
@@ -74,22 +83,6 @@ FormRenderer.include({
return this._super.apply(this, arguments);
}
},
- /**
- * Detaches the chatter before updating the $el. This is important because
- * if the view is now in create mode (edit mode with no res_id), the chatter
- * will be removed from the DOM, and its handlers will be unbound. By
- * detaching it beforehand, we ensure to keep its handlers alive so that if
- * it is re-appended later, everything will still work properly.
- *
- * @override
- * @private
- */
- _updateView: function () {
- if (this.chatter) {
- this.chatter.$el.detach();
- }
- return this._super.apply(this, arguments);
- },
});
/**