From afc0df5b0cddf9ff6381cfa886b40ff08c0d2909 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 17 Nov 2017 15:26:49 +0100 Subject: [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. --- addons/mail/static/src/js/basic_model.js | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 addons/mail/static/src/js/basic_model.js (limited to 'addons/mail/static/src/js/basic_model.js') diff --git a/addons/mail/static/src/js/basic_model.js b/addons/mail/static/src/js/basic_model.js new file mode 100644 index 00000000000..11139819a60 --- /dev/null +++ b/addons/mail/static/src/js/basic_model.js @@ -0,0 +1,33 @@ +odoo.define('mail.basic_model', function (require) { +"use strict"; + +var BasicModel = require('web.BasicModel'); + +/** + * Include the BasicModel to update the datapoint on the model when a + * message is posted. + */ +BasicModel.include({ + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * Update the message ids on a datapoint. + * + * Note that we directly update the res_ids on the datapoint as the message + * has already been posted ; this change can't be handled 'normally' with + * x2m commands because the change won't be saved as a normal field. + * + * @param {string} id + * @param {integer[]} msgIDs + */ + updateMessageIDs: function (id, msgIDs) { + var element = this.localData[id]; + element.res_ids = msgIDs; + element.count = msgIDs.length; + }, +}); + +}); -- cgit v1.2.3