summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/form_controller.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-11-17 15:26:49 +0100
committerMartin Geubelle <mge@odoo.com>2017-11-17 16:26:45 +0100
commitafc0df5b0cddf9ff6381cfa886b40ff08c0d2909 (patch)
treeaf2d5c1b343c57afdc7b393eada28d3d21462bc3 /addons/mail/static/src/js/form_controller.js
parent0fdf2913052eecd426be6515d8f77cbd176dcee1 (diff)
[REF] mail: create separate files for includes
The rev. odoo/odoo@ab900bb fixes an issue in mail which needed an include on BasicModel and FormController. As this rev. has been done in a stable branch, the includes have been done in an existing file. This rev. correctly separates the includes in different files.
Diffstat (limited to 'addons/mail/static/src/js/form_controller.js')
-rw-r--r--addons/mail/static/src/js/form_controller.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/form_controller.js b/addons/mail/static/src/js/form_controller.js
new file mode 100644
index 00000000000..b8cb5ab1c25
--- /dev/null
+++ b/addons/mail/static/src/js/form_controller.js
@@ -0,0 +1,31 @@
+
+odoo.define('mail.form_controller', function (require) {
+"use strict";
+
+var FormController = require('web.FormController');
+
+/**
+ * Include the FormController to update the datapoint on the model when a
+ * message is posted.
+ */
+FormController.include({
+ custom_events: _.extend({}, FormController.prototype.custom_events, {
+ new_message: '_onNewMessage',
+ }),
+
+ //--------------------------------------------------------------------------
+ // Handlers
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ * @param {OdooEvent} event
+ * @param {string} event.data.id datapointID
+ * @param {integer[]} event.data.msgIDs list of message ids
+ */
+ _onNewMessage: function (event) {
+ this.model.updateMessageIDs(event.data.id, event.data.msgIDs);
+ },
+});
+
+});