summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/form_controller.js
diff options
context:
space:
mode:
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);
+ },
+});
+
+});