Browse Source

MuK Web Client

8.0
Mathias Markl 7 years ago
parent
commit
c37654fb47
  1. 84
      .travis.yml
  2. 18
      README.md
  3. 0
      muk_web_client/LICENSE
  4. 24
      muk_web_client/README.md
  5. 20
      muk_web_client/__init__.py
  6. 61
      muk_web_client/__manifest__.py
  7. BIN
      muk_web_client/static/description/banner.png
  8. BIN
      muk_web_client/static/description/icon.png
  9. 55
      muk_web_client/static/description/index.html
  10. BIN
      muk_web_client/static/description/logo.png
  11. 87
      muk_web_client/static/src/js/client_channels.js
  12. 26
      muk_web_client/template/assets.xml

84
.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

18
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) [![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) [![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 # MuK Odoo Web Modules
addon | version | summary 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

0
LICENSE → muk_web_client/LICENSE

24
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) {
...
}
});
```

20
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 <http://www.gnu.org/licenses/>.
#
###################################################################################

61
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 <http://www.gnu.org/licenses/>.
#
###################################################################################
{
"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 <mathias.markl@mukit.at>",
],
"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,
}

BIN
muk_web_client/static/description/banner.png

After

Width: 880  |  Height: 440  |  Size: 35 KiB

BIN
muk_web_client/static/description/icon.png

After

Width: 250  |  Height: 250  |  Size: 5.2 KiB

55
muk_web_client/static/description/index.html

@ -0,0 +1,55 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Web Client</h2>
<h3 class="oe_slogan">Web Client Extension</h3>
<h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH -
www.mukit.at</h4>
</div>
</section>
<section class="oe_container" style="padding-top: 25px;">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32">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.
</p>
<p>
Example:
</p>
<pre>
<code>
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) {
...
}
});
</code>
</pre>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<h3 class="oe_slogan">Help and Support</h3>
<div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email
</a> <a class="btn btn-primary btn-lg mt8"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact
</a>
</div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;"
class="center-block">
</section>

BIN
muk_web_client/static/description/logo.png

After

Width: 500  |  Height: 500  |  Size: 37 KiB

87
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 <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
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);
},
});
});

26
muk_web_client/template/assets.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="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 <http://www.gnu.org/licenses/>.
-->
<odoo>
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr=".">
<script type="text/javascript" src="/muk_web_client/static/src/js/client_channels.js"/>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save