You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.9 KiB

7 years ago
  1. /**********************************************************************************
  2. *
  3. * Copyright (C) 2017 MuK IT GmbH
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Affero General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Affero General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. **********************************************************************************/
  19. odoo.define('muk_web_client_refresh.channel', function (require) {
  20. "use strict";
  21. var WebClient = require('web.WebClient');
  22. var session = require('web.session');
  23. var bus = require('bus.bus')
  24. WebClient.include({
  25. show_application: function() {
  26. var channel = session.db + '_refresh';
  27. this.bus_declare_channel(channel, this.refresh);
  28. return this._super();
  29. },
  30. refresh: function(message) {
  31. var active_view = this.action_manager.inner_widget.active_view
  32. if (active_view){
  33. var controller = this.action_manager.inner_widget.active_view.controller
  34. if (controller.model === message && !controller.$el.hasClass('o_form_editable')){
  35. if (active_view.type === "kanban")
  36. controller.do_reload();
  37. if (active_view.type === "list" || active_view.type === "form")
  38. controller.reload();
  39. }
  40. }
  41. }
  42. });
  43. });