diff --git a/.travis.yml b/.travis.yml index 79894f1..ae46418 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,41 @@ -language: python - -python: - - "2.7" - -notifications: - email: false - -sudo: false -cache: pip - -addons: - apt: - packages: - - expect-dev - - python-lxml - -env: - global: - - VERSION="10.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0" - - matrix: - - TESTS="1" ODOO_REPO="odoo/odoo" - -virtualenv: - system_site_packages: true - - - -install: - - pip install requests - - pip install cachetools - - pip install pdfconv - - pip install anybox.testing.openerp - - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - - travis_install_nightly - -script: - - travis_run_tests - -after_success: - - travis_after_tests_success +language: python + +python: + - "2.7" + +notifications: + email: false + +sudo: false +cache: pip + +addons: + apt: + packages: + - expect-dev + - python-lxml + +env: + global: + - VERSION="10.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0" + + matrix: + - TESTS="1" ODOO_REPO="odoo/odoo" + +virtualenv: + system_site_packages: true + +install: + - pip install requests + - pip install cachetools + - pip install pdfconv + - pip install anybox.testing.openerp + - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools + - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} + - travis_install_nightly + +script: + - travis_run_tests + +after_success: + - travis_after_tests_success diff --git a/README.md b/README.md index 8a5d5f8..f8b96c7 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,10 @@ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) -[![Build Status](https://travis-ci.org/muk-it/muk_web.svg?branch=10.0)](https://travis-ci.org/muk-it/muk_web) -[![codecov](https://codecov.io/gh/muk-it/muk_web/branch/10.0/graph/badge.svg)](https://codecov.io/gh/muk-it/muk_web) +[![Build Status](https://travis-ci.org/muk-it/muk_web.svg?branch=11.0)](https://travis-ci.org/muk-it/muk_web) +[![codecov](https://codecov.io/gh/muk-it/muk_web/branch/11.0/graph/badge.svg)](https://codecov.io/gh/muk-it/muk_web) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/eff47569926c435d98a3187623615bc4)](https://www.codacy.com/app/keshrath/muk_web?utm_source=github.com&utm_medium=referral&utm_content=muk-it/muk_web&utm_campaign=Badge_Grade) # MuK Odoo Web Modules addon | version | summary --- | --- | --- -[muk_web_export_attachment](muk_web_export_attachment/) | 10.0 | Export Odoo Attachments to PDF -[muk_web_glyphicons](muk_web_glyphicons/) | 10.0 | Bootstrap Glyphicons Support -[muk_web_preview](muk_web_preview/) | 10.0 | File Preview Dialog -[muk_web_preview_attachment](muk_web_preview_attachment/) | 10.0 | Attachment Preview Dialog -[muk_web_preview_audio](muk_web_preview_audio/) | 10.0 | Audio Preview -[muk_web_preview_csv](muk_web_preview_csv/) | 10.0 | CSV Preview -[muk_web_preview_image](muk_web_preview_image/) | 10.0 | Image Preview -[muk_web_preview_mail](muk_web_preview_mail/) | 10.0 | Mail Preview -[muk_web_preview_markdown](muk_web_preview_markdown/) | 10.0 | Markdown Preview -[muk_web_preview_msoffice](muk_web_preview_msoffice/) | 10.0 | MS Office Preview -[muk_web_preview_text](muk_web_preview_text/) | 10.0 | Text Preview -[muk_web_preview_vector](muk_web_preview_vector/) | 10.0 | Vector Preview -[muk_web_preview_video](muk_web_preview_video/) | 10.0 | Video Preview +[muk_web_client](muk_web_client/) | 11.0 | Odoo Web Client Extension diff --git a/LICENSE b/muk_web_client/LICENSE similarity index 100% rename from LICENSE rename to muk_web_client/LICENSE diff --git a/muk_web_client/README.md b/muk_web_client/README.md new file mode 100644 index 0000000..da8c4a4 --- /dev/null +++ b/muk_web_client/README.md @@ -0,0 +1,24 @@ +# MuK Web Client + +Extends the Odoo web client to include +bus channels. Channels can be created to listen to Odoo bus +notifications. To add a channel listener to the client just +extend the web client and declare a new bus channel. + +### Example + +```javascript +var WebClient = require('web.WebClient'); +var session = require('web.session'); + +WebClient.include({ + show_application: function() { + var channel = session.db + '_mychannel'; + this.bus_declare_channel(channel, this.doSomething); + return this._super(); + }, + doSomething: function(message) { + ... + } +}); +``` \ No newline at end of file diff --git a/muk_web_client/__init__.py b/muk_web_client/__init__.py new file mode 100644 index 0000000..48ccf85 --- /dev/null +++ b/muk_web_client/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +################################################################################### +# +# Copyright (C) 2017 MuK IT GmbH +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### diff --git a/muk_web_client/__manifest__.py b/muk_web_client/__manifest__.py new file mode 100644 index 0000000..0c9ccee --- /dev/null +++ b/muk_web_client/__manifest__.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +################################################################################### +# +# Copyright (C) 2017 MuK IT GmbH +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +{ + "name": "MuK Web Client", + "summary": """Odoo Web Client Extension""", + "description": """ + Extends the Odoo web client to include + bus channels. Channels can be created to listen to Odoo bus + notifications. To add a channel listener to the client just + extend the web client and declare a new bus channel. + """, + "version": "11.0.1.0.0", + "category": "Extra Tools", + "license": "AGPL-3", + "website": "http://www.mukit.at", + "author": "MuK IT", + "contributors": [ + "Mathias Markl ", + ], + "depends": [ + "web", + "bus", + ], + "data": [ + "template/assets.xml", + ], + "demo": [ + ], + "qweb": [ + "static/src/xml/*.xml", + ], + "images": [ + 'static/description/banner.png' + ], + "external_dependencies": { + "python": [], + "bin": [], + }, + "application": False, + "installable": True, + +} \ No newline at end of file diff --git a/muk_web_client/static/description/banner.png b/muk_web_client/static/description/banner.png new file mode 100644 index 0000000..d1ffbb4 Binary files /dev/null and b/muk_web_client/static/description/banner.png differ diff --git a/muk_web_client/static/description/icon.png b/muk_web_client/static/description/icon.png new file mode 100644 index 0000000..142cdda Binary files /dev/null and b/muk_web_client/static/description/icon.png differ diff --git a/muk_web_client/static/description/index.html b/muk_web_client/static/description/index.html new file mode 100644 index 0000000..7af3eb5 --- /dev/null +++ b/muk_web_client/static/description/index.html @@ -0,0 +1,55 @@ +
+
+

Web Client

+

Web Client Extension

+

MuK IT GmbH - + www.mukit.at

+
+
+ +
+
+
+

Overview

+

Extends the Odoo web client to include + bus channels. Channels can be created to listen to Odoo bus + notifications. To add a channel listener to the client just + extend the web client and declare a new bus channel. +

+

+ Example: +

+
+			    
+var WebClient = require('web.WebClient');
+var session = require('web.session');	
+
+WebClient.include({
+	show_application: function() {
+		var channel = session.db + '_mychannel';
+        this.bus_declare_channel(channel, this.doSomething);
+        return this._super();
+    },
+	doSomething: function(message) {
+		...
+	}
+});
+			    
+			
+
+
+
+ +
+

Help and Support

+ + +
\ No newline at end of file diff --git a/muk_web_client/static/description/logo.png b/muk_web_client/static/description/logo.png new file mode 100644 index 0000000..9427ce3 Binary files /dev/null and b/muk_web_client/static/description/logo.png differ diff --git a/muk_web_client/static/src/js/client_channels.js b/muk_web_client/static/src/js/client_channels.js new file mode 100644 index 0000000..e93a229 --- /dev/null +++ b/muk_web_client/static/src/js/client_channels.js @@ -0,0 +1,87 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +odoo.define('muk_web_client.channel', function (require) { +"use strict"; + +var WebClient = require('web.WebClient'); +var session = require('web.session'); +var bus = require('bus.bus') + +WebClient.include({ + init: function(parent, client_options){ + this._super(parent, client_options); + this.bus_channels = []; + this.bus_events = []; + }, + show_application: function() { + var _super = this._super(); + bus.bus.on('notification', this, this.bus_notification); + bus.bus.start_polling(); + return _super; + }, + destroy: function() { + var self = this; + bus.bus.off('notification', this, this.bus_notification); + $.each(this.bus_channels, function(index, channel) { + self.bus_delete_channel(channel); + }); + $.each(this.bus_events, function(index, event) { + self.bus_off(event[0], event[1]); + }); + this._super(); + }, + bus_declare_channel: function(channel, method) { + if($.inArray(channel, this.bus_channels) === -1) { + this.bus_on(channel, method); + this.bus_channels.push(channel); + bus.bus.add_channel(channel); + } + }, + bus_delete_channel: function(channel) { + var index = $.inArray(channel, this.bus_channels); + bus.bus.delete_channel(channel); + this.bus_channels.splice(index, 1); + }, + bus_notification: function(notifications) { + var self = this; + $.each(notifications, function(index, notification) { + var channel = notification[0]; + var message = notification[1]; + if($.inArray(channel, self.bus_channels) !== -1) { + bus.bus.trigger(channel, message); + } + }); + }, + bus_on: function(name, event) { + bus.bus.on(name, this, event); + this.bus_events.push([name, event]); + }, + bus_off: function(name, event) { + var index = $.map(this.bus_events, function(tuple, index) { + if(tuple[0] === name && tuple[1] === event) { + return index; + } + }); + bus.bus.off(name, this, event); + this.bus_events.splice(index, 1); + }, +}); + +}); diff --git a/muk_web_client/template/assets.xml b/muk_web_client/template/assets.xml new file mode 100644 index 0000000..eea5223 --- /dev/null +++ b/muk_web_client/template/assets.xml @@ -0,0 +1,26 @@ + + + + + +