From 952da4752ff97cd4083fd6f6ae63f712d5d437d4 Mon Sep 17 00:00:00 2001 From: x620 Date: Wed, 1 Jun 2016 13:18:34 +0500 Subject: [PATCH] [PORT] Changed outdated methods: self.check_for_rerender() and FormOpenPopup() --- .../static/src/js/mail_move_message.js | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/mail_move_message/static/src/js/mail_move_message.js b/mail_move_message/static/src/js/mail_move_message.js index 5dad991..eeebfdc 100644 --- a/mail_move_message/static/src/js/mail_move_message.js +++ b/mail_move_message/static/src/js/mail_move_message.js @@ -1,8 +1,10 @@ odoo.define('mail_move_message.relocate', function (require) { "use strict"; + var chat_manager = require('mail.chat_manager'); var base_obj = require('mail_base.base'); var Model = require('web.Model'); + var form_common = require('web.form_common'); var core = require('web.core'); var QWeb = core.qweb; @@ -36,9 +38,8 @@ odoo.define('mail_move_message.relocate', function (require) { }; self.do_action(action, { - 'on_close': function(){ - // TODO: this method is not exist in 9.0. Replace to compatible method - // self.check_for_rerender(); + 'on_close': function(message){ + chat_manager.bus.trigger('update_message', message); } }); } @@ -79,26 +80,22 @@ odoo.define('mail_move_message.relocate', function (require) { if(self.node.attrs.use_for_mail_move_message) { self.field_manager.fields['partner_id'].set_value(context['partner_id']); } - // TODO: this method is not exist in 9.0. Create similar method for 9.0 - // var pop = new session.web.form.FormOpenPopup(this); - // pop.show_element( - // related_field.field.relation, - // false, - // context, - // { - // title: _t("Create new record"), - // } - // ); - // pop.on('closed', self, function () { - // self.force_disabled = false; - // self.check_disable(); - // }); - // pop.on('create_completed', self, function(id) { - // related_field.set_value(id); - // if(self.field_manager.fields['filter_by_partner']) { - // self.field_manager.fields['filter_by_partner'].set_value(true); - // } - // }); + var dialog = new form_common.FormViewDialog(self, { + res_model: related_field.field.relation, + res_id: false, + context: context, + title: _t("Create new record") + }).open(); + dialog.on('closed', self, function () { + self.force_disabled = false; + self.check_disable(); + }); + dialog.on('create_completed', self, function(id) { + related_field.set_value(id); + if(self.field_manager.fields['filter_by_partner']) { + self.field_manager.fields['filter_by_partner'].set_value(true); + } + }); }); } else {