Browse Source

[PORT] Changed outdated methods: self.check_for_rerender() and FormOpenPopup()

pull/36/head
x620 9 years ago
parent
commit
952da4752f
  1. 43
      mail_move_message/static/src/js/mail_move_message.js

43
mail_move_message/static/src/js/mail_move_message.js

@ -1,8 +1,10 @@
odoo.define('mail_move_message.relocate', function (require) { odoo.define('mail_move_message.relocate', function (require) {
"use strict"; "use strict";
var chat_manager = require('mail.chat_manager');
var base_obj = require('mail_base.base'); var base_obj = require('mail_base.base');
var Model = require('web.Model'); var Model = require('web.Model');
var form_common = require('web.form_common');
var core = require('web.core'); var core = require('web.core');
var QWeb = core.qweb; var QWeb = core.qweb;
@ -36,9 +38,8 @@ odoo.define('mail_move_message.relocate', function (require) {
}; };
self.do_action(action, { 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) { if(self.node.attrs.use_for_mail_move_message) {
self.field_manager.fields['partner_id'].set_value(context['partner_id']); 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 { else {

Loading…
Cancel
Save