Browse Source

update 2.0

8.0
Mathias Markl 7 years ago
parent
commit
6c226483b8
  1. 24
      muk_web_client/README.md
  2. 4
      muk_web_client/__init__.py
  3. 16
      muk_web_client/__manifest__.py
  4. 5
      muk_web_client/doc/changelog.rst
  5. 48
      muk_web_client/doc/index.rst
  6. 43
      muk_web_client/i18n/de.po
  7. 40
      muk_web_client/i18n/muk_web_client.pot
  8. 20
      muk_web_client/models/__init__.py
  9. 29
      muk_web_client/models/res_config_settings.py
  10. 46
      muk_web_client/static/description/index.html
  11. 10
      muk_web_client/static/src/js/client_channels.js
  12. 49
      muk_web_client/views/res_config_settings_view.xml
  13. 17
      muk_web_client_refresh/README.md
  14. 3
      muk_web_client_refresh/__init__.py
  15. 20
      muk_web_client_refresh/__manifest__.py
  16. 20
      muk_web_client_refresh/controllers/__init__.py
  17. 34
      muk_web_client_refresh/controllers/main.py
  18. 6
      muk_web_client_refresh/doc/changelog.rst
  19. 53
      muk_web_client_refresh/doc/index.rst
  20. 126
      muk_web_client_refresh/i18n/de.po
  21. 105
      muk_web_client_refresh/i18n/muk_web_client_refresh.pot
  22. 4
      muk_web_client_refresh/models/__init__.py
  23. 42
      muk_web_client_refresh/models/res_config_settings.py
  24. BIN
      muk_web_client_refresh/static/description/demo.gif
  25. 105
      muk_web_client_refresh/static/description/index.html
  26. BIN
      muk_web_client_refresh/static/description/screenshot_chatter.png
  27. BIN
      muk_web_client_refresh/static/description/screenshot_view.png
  28. 47
      muk_web_client_refresh/static/src/js/client_refresh.js
  29. 82
      muk_web_client_refresh/views/refresh_action_view.xml
  30. 41
      muk_web_client_refresh/views/res_config_settings_view.xml
  31. 3
      muk_web_utils/README.md
  32. 2
      muk_web_utils/__init__.py
  33. 10
      muk_web_utils/__manifest__.py
  34. 5
      muk_web_utils/doc/changelog.rst
  35. 46
      muk_web_utils/doc/index.rst
  36. 39
      muk_web_utils/static/description/index.html
  37. 2
      muk_web_utils/static/src/js/common.js
  38. 34
      muk_web_utils/static/src/js/mimetype.js
  39. 3
      muk_web_utils/tests/__init__.py
  40. 12
      muk_web_utils/tests/test_utils.py

24
muk_web_client/README.md

@ -1,24 +0,0 @@
# 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) {
...
}
});
```

4
muk_web_client/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -18,3 +16,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
################################################################################### ###################################################################################
from . import models

16
muk_web_client/__manifest__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -22,16 +20,11 @@
{ {
"name": "MuK Web Client", "name": "MuK Web Client",
"summary": """Odoo Web Client Extension""", "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.1",
"version": "11.0.2.0.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",
"live_test_url": "https://demo.mukit.at/web/login",
"author": "MuK IT", "author": "MuK IT",
"contributors": [ "contributors": [
"Mathias Markl <mathias.markl@mukit.at>", "Mathias Markl <mathias.markl@mukit.at>",
@ -39,11 +32,12 @@
"depends": [ "depends": [
"web", "web",
"bus", "bus",
"base_setup",
"muk_web_utils",
], ],
"data": [ "data": [
"template/assets.xml", "template/assets.xml",
],
"demo": [
"views/res_config_settings_view.xml",
], ],
"qweb": [ "qweb": [
"static/src/xml/*.xml", "static/src/xml/*.xml",

5
muk_web_client/doc/changelog.rst

@ -1,3 +1,8 @@
`2.0.0`
-------
- Migrated to Python 3
`1.0.0` `1.0.0`
------- -------

48
muk_web_client/doc/index.rst

@ -0,0 +1,48 @@
==============
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.
Installation
============
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to
your Odoo server and go to the Apps menu. Trigger the debug modus and update the
list by clicking on the "Update Apps List" link. Now install the module by
clicking on the install button.
Configuration
=============
No additional configuration is needed to use this module.
Usage
=============
This module has no direct visible effect on the system. It adds bus channels
to the existing web client.
Credits
=======
Contributors
------------
* Mathias Markl <mathias.markl@mukit.at>
Author & Maintainer
-------------------
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
MuK IT is an Austrian company specialized in customizing and extending Odoo.
We develop custom solutions for your individual needs to help you focus on
your strength and expertise to grow your business.
If you want to get in touch please contact us via mail
(sale@mukit.at) or visit our website (https://mukit.at).

43
muk_web_client/i18n/de.po

@ -1,16 +1,53 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * muk_web_client
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n" "Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 12:40+0000\n"
"PO-Revision-Date: 2018-01-19 12:40+0000\n"
"POT-Creation-Date: 2018-05-04 22:53+0000\n"
"PO-Revision-Date: 2018-05-05 00:55+0200\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n" "Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.6\n"
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "<strong>Save</strong> this page and come back here to set up the feature."
msgstr "<strong>Speichern</strong> diese Seite und kommen Sie hierher zurück, um das Feature einzurichten."
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "Automated Refresh"
msgstr "Automatisches Neuladen"
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "Define action rules to automatically refresh views"
msgstr "Definieren von Aktionsregeln zur automatischen Aktualisierung von Ansichten"
#. module: muk_web_client
#: model:ir.model.fields,help:muk_web_client.field_res_config_settings_module_muk_web_client_refresh
msgid "Define action rules to automatically refresh views."
msgstr "Definieren von Aktionsregeln zur automatischen Aktualisierung von Ansichten."
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "Web Client"
msgstr "Web Client"
#. module: muk_web_client
#: model:ir.model.fields,field_description:muk_web_client.field_res_config_settings_module_muk_web_client_refresh
msgid "Web Refresh"
msgstr "Web Refresh"
#. module: muk_web_client
#: model:ir.model,name:muk_web_client.model_res_config_settings
msgid "res.config.settings"
msgstr "res.config.settings"

40
muk_web_client/i18n/muk_web_client.pot

@ -1,12 +1,13 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * muk_web_client
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n" "Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 12:40+0000\n"
"PO-Revision-Date: 2018-01-19 12:40+0000\n"
"POT-Creation-Date: 2018-05-04 22:53+0000\n"
"PO-Revision-Date: 2018-05-04 22:53+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -14,3 +15,38 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "<strong>Save</strong> this page and come back here to set up the feature."
msgstr ""
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "Automated Refresh"
msgstr ""
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "Define action rules to automatically refresh views"
msgstr ""
#. module: muk_web_client
#: model:ir.model.fields,help:muk_web_client.field_res_config_settings_module_muk_web_client_refresh
msgid "Define action rules to automatically refresh views."
msgstr ""
#. module: muk_web_client
#: model:ir.ui.view,arch_db:muk_web_client.res_config_settings_view_form
msgid "Web Client"
msgstr ""
#. module: muk_web_client
#: model:ir.model.fields,field_description:muk_web_client.field_res_config_settings_module_muk_web_client_refresh
msgid "Web Refresh"
msgstr ""
#. module: muk_web_client
#: model:ir.model,name:muk_web_client.model_res_config_settings
msgid "res.config.settings"
msgstr ""

20
muk_web_client/models/__init__.py

@ -0,0 +1,20 @@
###################################################################################
#
# 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/>.
#
###################################################################################
from . import res_config_settings

29
muk_web_client/models/res_config_settings.py

@ -0,0 +1,29 @@
###################################################################################
#
# 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/>.
#
###################################################################################
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
module_muk_web_client_refresh = fields.Boolean(
string="Web Refresh",
help="Define action rules to automatically refresh views.")

46
muk_web_client/static/description/index.html

@ -9,14 +9,13 @@
<section class="oe_container" style="padding-bottom: 50px;"> <section class="oe_container" style="padding-bottom: 50px;">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_picture">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Overview</h3> <h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32" style="padding-bottom: 10px; text-align: justify;"> <p class="oe_mt32" style="padding-bottom: 10px; text-align: justify;">
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>
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>
<pre> <pre>
<code> <code>
var WebClient = require('web.WebClient'); var WebClient = require('web.WebClient');
@ -24,9 +23,9 @@ var session = require('web.session');
WebClient.include({ WebClient.include({
show_application: function() { show_application: function() {
var channel = session.db + '_mychannel';
var channel = 'mychannel';
this.bus_declare_channel(channel, this.doSomething); this.bus_declare_channel(channel, this.doSomething);
return this._super();
return this._super.apply(this, arguments);
}, },
doSomething: function(message) { doSomething: function(message) {
... ...
@ -38,14 +37,45 @@ WebClient.include({
</div> </div>
</section> </section>
<section class="oe_container oe_dark"
style="margin-bottom: 20px; border-top: 5px solid #797979; border-bottom: 5px solid #797979;">
<h3 class="oe_slogan" style="margin-bottom: 10px;">Demo</h3>
<div class="row" style="margin: auto; max-width: 200px;">
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">User:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">apps</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">Password:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">demo</h5>
</div>
</div>
<div class="oe_slogan" style="margin-top: 5px;">
<a class="btn btn-primary btn-lg mt8" href="https://demo.mukit.at/web/login"
style="position: relative; overflow: hidden;"><span
class="o_ripple"
style="height: 138px; width: 138px; top: -35.2969px; left: -8.17188px;"></span>
<i class="fa fa-video-camera"></i> Live Preview </a>
</div>
</section>
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<h3 class="oe_slogan">Help and Support</h3> <h3 class="oe_slogan">Help and Support</h3>
<h5 class="oe_slogan" style="font-size: 20px;">Feel free to
contact us, if you need any help with your Odoo integration or addiontal
features.</h5>
<div class="oe_slogan"> <div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at"> <a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email <i class="fa fa-envelope"></i> Email
</a> <a class="btn btn-primary btn-lg mt8" </a> <a class="btn btn-primary btn-lg mt8"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i> href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact Contact
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support
</a> </a>
</div> </div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;" <img src="logo.png" style="width: 200px; margin-bottom: 20px;"

10
muk_web_client/static/src/js/client_channels.js

@ -22,19 +22,19 @@ odoo.define('muk_web_client.channel', function (require) {
var WebClient = require('web.WebClient'); var WebClient = require('web.WebClient');
var session = require('web.session'); var session = require('web.session');
var bus = require('bus.bus')
var bus = require('bus.bus');
WebClient.include({ WebClient.include({
init: function(parent, client_options){ init: function(parent, client_options){
this._super(parent, client_options);
this._super.apply(this, arguments);
this.bus_channels = []; this.bus_channels = [];
this.bus_events = []; this.bus_events = [];
}, },
show_application: function() { show_application: function() {
var _super = this._super();
var res = this._super();
bus.bus.on('notification', this, this.bus_notification); bus.bus.on('notification', this, this.bus_notification);
bus.bus.start_polling(); bus.bus.start_polling();
return _super;
return res;
}, },
destroy: function() { destroy: function() {
var self = this; var self = this;
@ -45,7 +45,7 @@ WebClient.include({
$.each(this.bus_events, function(index, event) { $.each(this.bus_events, function(index, event) {
self.bus_off(event[0], event[1]); self.bus_off(event[0], event[1]);
}); });
this._super();
this._super.apply(this, arguments);
}, },
bus_declare_channel: function(channel, method) { bus_declare_channel: function(channel, method) {
if($.inArray(channel, this.bus_channels) === -1) { if($.inArray(channel, this.bus_channels) === -1) {

49
muk_web_client/views/res_config_settings_view.xml

@ -0,0 +1,49 @@
<?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>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
<field name="arch" type="xml">
<div name="multi_company" position="after">
<h2>Web Client</h2>
<div class="row mt16 o_settings_container" name="web_client">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="module_muk_web_client_refresh" />
</div>
<div class="o_setting_right_pane">
<label string="Automated Refresh" for="module_muk_web_client_refresh"/>
<div class="text-muted">
Define action rules to automatically refresh views
</div>
<div class="content-group" attrs="{'invisible': [('module_muk_web_client_refresh','=',False)]}" id="msg_module_muk_web_client_refresh">
<div class="text-warning mt16"><strong>Save</strong> this page and come back here to set up the feature.</div>
</div>
</div>
</div>
</div>
</div>
</field>
</record>
</odoo>

17
muk_web_client_refresh/README.md

@ -1,17 +0,0 @@
# MuK Web Client Refresh
Adds a "refresh" channel to the web client,
which can be used to trigger a view refresh without refreshing the
browser itself. Furthermore, it allows the user the creation of
"refresh" rules. These rules can be applied to any Odoo model and
trigger a refresh either on create, write or unlink.
## Python Support
Besides creating a "refresh" rule, a view refresh can be triggered
manually via python. This can be useful if there is a need for a
view refresh on other operations like an action.
```python
self.env['bus.bus'].sendone('refresh', [self.env.cr.dbname, self._name, self._uid])
```

3
muk_web_client_refresh/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -19,4 +17,5 @@
# #
################################################################################### ###################################################################################
from . import controllers
from . import models from . import models

20
muk_web_client_refresh/__manifest__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -22,31 +20,23 @@
{ {
"name": "MuK Web Refresh", "name": "MuK Web Refresh",
"summary": """Web Client Refresh""", "summary": """Web Client Refresh""",
"description": """
Adds a "refresh" channel to the web client,
which can be used to trigger a view refresh without refreshing the
browser itself. Furthermore, it allows the user the creation of
"refresh" rules. These rules can be applied to any Odoo model and
trigger a refresh either on create, write or unlink.
""",
"version": "11.0.1.0.4",
"version": "11.0.2.0.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",
"live_test_url": "https://demo.mukit.at/web/login",
"author": "MuK IT", "author": "MuK IT",
"contributors": [ "contributors": [
"Mathias Markl <mathias.markl@mukit.at>", "Mathias Markl <mathias.markl@mukit.at>",
], ],
"depends": [ "depends": [
"base_automation",
"muk_web_client", "muk_web_client",
], ],
"data": [ "data": [
"template/assets.xml", "template/assets.xml",
"security/ir.model.access.csv",
"views/refresh_menu.xml",
"views/refresh_rule_view.xml",
],
"demo": [
"views/refresh_action_view.xml",
"views/res_config_settings_view.xml",
], ],
"qweb": [ "qweb": [
"static/src/xml/*.xml", "static/src/xml/*.xml",

20
muk_web_client_refresh/controllers/__init__.py

@ -0,0 +1,20 @@
###################################################################################
#
# 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/>.
#
###################################################################################
from . import main

34
muk_web_client_refresh/controllers/main.py

@ -0,0 +1,34 @@
###################################################################################
#
# 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/>.
#
###################################################################################
import logging
from odoo import http
from odoo.http import request
_logger = logging.getLogger(__name__)
class RefreshController(http.Controller):
@http.route('/config/muk_web_client_refresh.refresh_delay', type='json', auth="user")
def refresh_delay(self, **kw):
params = request.env['ir.config_parameter'].sudo()
return {
'refresh_delay': int(params.get_param("muk_web_client_refresh.refresh_delay", default=10000))
}

6
muk_web_client_refresh/doc/changelog.rst

@ -1,3 +1,9 @@
`2.0.0`
-------
- Migrated to Python 3
- Replaced Auto Refresh Rule by Automated Action
`1.0.0` `1.0.0`
------- -------

53
muk_web_client_refresh/doc/index.rst

@ -0,0 +1,53 @@
======================
MuK Web Client Refresh
======================
Adds a channel called "refresh" to the web client, which can be used to trigger
a view reload without refreshing the browser itself. Furthermore, it allows the
user the creation of action rules. These rules can be applied to any model and
trigger a refresh either on create, update or unlink.
Installation
============
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to
your Odoo server and go to the Apps menu. Trigger the debug modus and update the
list by clicking on the "Update Apps List" link. Now install the module by
clicking on the install button.
Configuration
=============
To configure this module, you need to:
#. Go to *Settings* while being in debug mode.
#. Afterwards go to *Technical -> Automation -> Automated Refresh*.
#. And create a new refresh action.
Usage
=============
Besides creating a action rule, a view refresh can be triggered manually via python.
This can be useful if there is a need for a view reload on other operations.
Credits
=======
Contributors
------------
* Mathias Markl <mathias.markl@mukit.at>
Author & Maintainer
-------------------
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
MuK IT is an Austrian company specialized in customizing and extending Odoo.
We develop custom solutions for your individual needs to help you focus on
your strength and expertise to grow your business.
If you want to get in touch please contact us via mail
(sale@mukit.at) or visit our website (https://mukit.at).

126
muk_web_client_refresh/i18n/de.po

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n" "Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 12:42+0000\n"
"PO-Revision-Date: 2018-01-19 13:45+0100\n"
"POT-Creation-Date: 2018-05-04 22:56+0000\n"
"PO-Revision-Date: 2018-05-05 00:58+0200\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -15,110 +15,50 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n" "Plural-Forms: \n"
"Language: de\n" "Language: de\n"
"X-Generator: Poedit 2.0.5\n"
"X-Generator: Poedit 2.0.6\n"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_form
msgid "Access Rights"
msgstr "Zugriffsrechte"
#: model:ir.actions.act_window,name:muk_web_client_refresh.action_client_refresh_actions
#: model:ir.ui.menu,name:muk_web_client_refresh.menu_client_refresh_actions
msgid "Automated Refresh"
msgstr "Automatisches Neuladen"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.ui.menu,name:muk_web_client_refresh.cat_menu_refresh
msgid "Auto Refresh"
msgstr "Automatische Aktualisierung"
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_client_refresh_actions_tree
msgid "Automation"
msgstr "Automatisierung"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model,name:muk_web_client_refresh.model_muk_web_client_refresh_rule
msgid "Auto Refresh Rule"
msgstr "Regeln für die automatische Aktualisierung"
#: model:ir.actions.act_window,help:muk_web_client_refresh.action_client_refresh_actions
msgid "Click to setup a new automated refresh action."
msgstr "Klicken Sie hier, um eine neue automatische Aktualisierungsaktion einzurichten."
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_create_uid
msgid "Created by"
msgstr "Erstellt von"
#: model:ir.ui.view,arch_db:muk_web_client_refresh.res_config_settings_view_form
msgid "Configure Actions"
msgstr "Aktionen konfigurieren"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_create_date
msgid "Created on"
msgstr "Erstellt am"
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_res_config_settings_refresh_delay
#: model:ir.ui.view,arch_db:muk_web_client_refresh.res_config_settings_view_form
msgid "Delay"
msgstr "Verzögerung"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_display_name
msgid "Display Name"
msgstr "Anzeigename"
#. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_tree
msgid "Document Settings"
msgstr "Einstellungen"
#. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_form
msgid "General"
msgstr "Allgemein"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_id
msgid "ID"
msgstr "ID"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule___last_update
msgid "Last Modified on"
msgstr "Zuletzt geändert am"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_write_uid
msgid "Last Updated by"
msgstr "Zuletzt aktualisiert durch"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_write_date
msgid "Last Updated on"
msgstr "Zuletzt aktualisiert am"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_model
msgid "Model"
msgstr "Modell"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_name
msgid "Name"
msgstr "Name"
#. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_form
msgid "Refresh Rule"
msgstr "Regel für die Aktualisierung"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_refresh_create
msgid "Refresh on Create"
msgstr "Aktualisierung nach der Erstellung"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_refresh_unlink
msgid "Refresh on Unlink"
msgstr "Aktualisierung nach dem Löschen"
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_refresh_write
msgid "Refresh on Writes"
msgstr "Aktualisierung nach dem Schreiben"
#. module: muk_web_client_refresh
#: model:ir.actions.act_window,name:muk_web_client_refresh.action_refresh_rule
#: model:ir.ui.menu,name:muk_web_client_refresh.menu_dms_settings
msgid "Rules"
msgstr "Regeln"
#: model:ir.model.fields,help:muk_web_client_refresh.field_res_config_settings_refresh_delay
msgid ""
"Delays the execution of refresh and thus prevents the view from being reloaded too often.\n"
" For example, a delay of 1000 (ms) would mean that the view cannot be reloaded more than once a second. "
msgstr ""
"Verzögert die Ausführung des Refresh und verhindert so, dass der View zu oft neu geladen wird.\n"
" Beispielsweise würde eine Verzögerung von 1000 (ms) bedeuten, dass der View nicht mehr als einmal pro Sekunde neu geladen werden kann. "
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,help:muk_web_client_refresh.field_muk_web_client_refresh_rule_model
msgid "Select model for which you want to refresh the corresponding views."
msgstr "Wählen Sie das Modell aus, für das Sie die entsprechenden Sichten aktualisieren möchten."
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_client_refresh_actions_form
msgid "e.g. Refresh Users on Create"
msgstr "z.B. Benutzer beim Anlegen neuladen"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: sql_constraint:muk_web_client_refresh.rule:0
msgid "There is already a rule defined on this model."
msgstr "Für dieses Modell ist bereits eine Regel definiert."
#: model:ir.model,name:muk_web_client_refresh.model_res_config_settings
msgid "res.config.settings"
msgstr "res.config.settings"

105
muk_web_client_refresh/i18n/muk_web_client_refresh.pot

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n" "Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 12:42+0000\n"
"PO-Revision-Date: 2018-01-19 12:42+0000\n"
"POT-Creation-Date: 2018-05-04 22:55+0000\n"
"PO-Revision-Date: 2018-05-04 22:55+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,108 +16,45 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_form
msgid "Access Rights"
#: model:ir.actions.act_window,name:muk_web_client_refresh.action_client_refresh_actions
#: model:ir.ui.menu,name:muk_web_client_refresh.menu_client_refresh_actions
msgid "Automated Refresh"
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.ui.menu,name:muk_web_client_refresh.cat_menu_refresh
msgid "Auto Refresh"
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_client_refresh_actions_tree
msgid "Automation"
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model,name:muk_web_client_refresh.model_muk_web_client_refresh_rule
msgid "Auto Refresh Rule"
#: model:ir.actions.act_window,help:muk_web_client_refresh.action_client_refresh_actions
msgid "Click to setup a new automated refresh action."
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_create_uid
msgid "Created by"
#: model:ir.ui.view,arch_db:muk_web_client_refresh.res_config_settings_view_form
msgid "Configure Actions"
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_create_date
msgid "Created on"
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_res_config_settings_refresh_delay
#: model:ir.ui.view,arch_db:muk_web_client_refresh.res_config_settings_view_form
msgid "Delay"
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_display_name
msgid "Display Name"
#: model:ir.model.fields,help:muk_web_client_refresh.field_res_config_settings_refresh_delay
msgid "Delays the execution of refresh and thus prevents the view from being reloaded too often.\n"
" For example, a delay of 1000 (ms) would mean that the view cannot be reloaded more than once a second. "
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_tree
msgid "Document Settings"
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_client_refresh_actions_form
msgid "e.g. Refresh Users on Create"
msgstr "" msgstr ""
#. module: muk_web_client_refresh #. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_form
msgid "General"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_id
msgid "ID"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule___last_update
msgid "Last Modified on"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_write_uid
msgid "Last Updated by"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_write_date
msgid "Last Updated on"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_model
msgid "Model"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_name
msgid "Name"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.ui.view,arch_db:muk_web_client_refresh.view_refresh_rule_form
msgid "Refresg Rule"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_refresh_create
msgid "Refresh on Create"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_refresh_unlink
msgid "Refresh on Unlink"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,field_description:muk_web_client_refresh.field_muk_web_client_refresh_rule_refresh_write
msgid "Refresh on Writes"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.actions.act_window,name:muk_web_client_refresh.action_refresh_rule
#: model:ir.ui.menu,name:muk_web_client_refresh.menu_dms_settings
msgid "Rules"
msgstr ""
#. module: muk_web_client_refresh
#: model:ir.model.fields,help:muk_web_client_refresh.field_muk_web_client_refresh_rule_model
msgid "Select model for which you want to refresh the corresponding views."
msgstr ""
#. module: muk_web_client_refresh
#: sql_constraint:muk_web_client_refresh.rule:0
msgid "There is already a rule defined on this model."
#: model:ir.model,name:muk_web_client_refresh.model_res_config_settings
msgid "res.config.settings"
msgstr "" msgstr ""

4
muk_web_client_refresh/models/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -19,4 +17,4 @@
# #
################################################################################### ###################################################################################
from . import refresh_rule
from . import res_config_settings

42
muk_web_client_refresh/models/res_config_settings.py

@ -0,0 +1,42 @@
###################################################################################
#
# 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/>.
#
###################################################################################
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
refresh_delay = fields.Integer(
string="Delay",
help="""Delays the execution of refresh and thus prevents the view from being reloaded too often.
For example, a delay of 1000 (ms) would mean that the view cannot be reloaded more than once a second. """)
def set_values(self):
res = super(ResConfigSettings, self).set_values()
param = self.env['ir.config_parameter'].sudo()
param.set_param("muk_web_client_refresh.refresh_delay", self.refresh_delay)
return res
@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
params = self.env['ir.config_parameter'].sudo()
res.update(refresh_delay=int(params.get_param("muk_web_client_refresh.refresh_delay", default=1000)))
return res

BIN
muk_web_client_refresh/static/description/demo.gif

After

Width: 800  |  Height: 450  |  Size: 381 KiB

105
muk_web_client_refresh/static/description/index.html

@ -2,74 +2,105 @@
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<h2 class="oe_slogan">Auto Refresh</h2> <h2 class="oe_slogan">Auto Refresh</h2>
<h3 class="oe_slogan">View Refresh Channel</h3> <h3 class="oe_slogan">View Refresh Channel</h3>
<h4 class="oe_slogan" style="font-size: 23px;">
MuK IT GmbH - www.mukit.at
</h4>
<div class="text-center oe_mt32">
<video width="70%" height="70%" controls="controls" autoplay="autoplay" loop="loop">
<source src="demo.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<h4 class="oe_slogan" style="font-size: 23px;">MuK IT GmbH -
www.mukit.at</h4>
<div class="oe_demo oe_screenshot"
style="max-width: 84%; margin: 16px 8%;">
<img src="demo.gif">
</div>
</div> </div>
</section> </section>
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_picture">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Overview</h3> <h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32 text-justify">Adds a "refresh" channel to the web client,
which can be used to trigger a view refresh without refreshing the
browser itself. Furthermore, it allows the user the creation of
"refresh" rules. These rules can be applied to any Odoo model and
trigger a refresh either on create, write or unlink.</p>
<p class="oe_mt32 text-justify">Adds a channel called "refresh"
to the web client, which can be used to trigger a view reload
without refreshing the browser itself. Furthermore, it allows the
user the creation of action rules. These rules can be applied to any
model and trigger a refresh either on create, update or unlink.</p>
</div> </div>
</div> </div>
</section> </section>
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<h3 class="oe_slogan">Rule View</h3>
<div class="oe_span6">
<p class="oe_mt32 text-justify">
Refresh rules can be created easily inside of Odoo. The view to
create rules is located under "Settings" <i
class="fa fa-arrow-right" aria-hidden="true"></i> "Technical" <i
class="fa fa-arrow-right" aria-hidden="true"></i> "Auto Refresh" <i
class="fa fa-arrow-right" aria-hidden="true"></i> "Rule". <br>
Each model can only have one corresponding rule to prevent
inconsistency.
</p>
</div>
<div class="oe_span6">
<img class="oe_picture oe_screenshot" src="screenshot_view.png">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Rule View</h3>
<div class="oe_span6">
<p class="oe_mt32 text-justify">
Refresh actions can be created easily inside of Odoo. The view to
create such rules is located under "Settings" <i
class="fa fa-arrow-right" aria-hidden="true"></i> "Technical" <i
class="fa fa-arrow-right" aria-hidden="true"></i> "Automation" <i
class="fa fa-arrow-right" aria-hidden="true"></i> "Automated
Refresh".
</p>
</div>
<div class="oe_span6">
<img class="oe_picture oe_screenshot" src="screenshot_view.png">
</div>
</div> </div>
</div> </div>
</section> </section>
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<h3 class="oe_slogan">Chatter Support</h3>
<div class="oe_span6">
<img class="oe_picture oe_screenshot" src="screenshot_chatter.png">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Chatter Support</h3>
<div class="oe_span6">
<img class="oe_picture oe_screenshot" src="screenshot_chatter.png">
</div>
<div class="oe_span6">
<p class="oe_mt32 text-justify">The module also has support for
the Odoo Chatter Widget. As soon as a new message or activity is
created, a corresponding refresh message is sent.</p>
</div>
</div> </div>
<div class="oe_span6">
<p class="oe_mt32 text-justify">Auto Refresh supports the Odoo
Chatter Widget. By creating a rule for the Message model and one for
the Activity model, the corresponding views will refresh if a new
message is sent.</p>
</div>
</section>
<section class="oe_container oe_dark"
style="margin-bottom: 20px; border-top: 5px solid #797979; border-bottom: 5px solid #797979;">
<h3 class="oe_slogan" style="margin-bottom: 10px;">Demo</h3>
<div class="row" style="margin: auto; max-width: 200px;">
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">User:</h5>
</div> </div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">apps</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">Password:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">demo</h5>
</div>
</div>
<div class="oe_slogan" style="margin-top: 5px;">
<a class="btn btn-primary btn-lg mt8"
href="https://demo.mukit.at/web/login"
style="position: relative; overflow: hidden;"><span
class="o_ripple"
style="height: 138px; width: 138px; top: -35.2969px; left: -8.17188px;"></span>
<i class="fa fa-video-camera"></i> Live Preview </a>
</div> </div>
</section> </section>
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<h3 class="oe_slogan">Help and Support</h3> <h3 class="oe_slogan">Help and Support</h3>
<h5 class="oe_slogan" style="font-size: 20px;">Feel free to
contact us, if you need any help with your Odoo integration or
addiontal features.</h5>
<div class="oe_slogan"> <div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at"> <a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email <i class="fa fa-envelope"></i> Email
</a> <a class="btn btn-primary btn-lg mt8" </a> <a class="btn btn-primary btn-lg mt8"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i> href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact Contact
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support
</a> </a>
</div> </div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;" <img src="logo.png" style="width: 200px; margin-bottom: 20px;"

BIN
muk_web_client_refresh/static/description/screenshot_chatter.png

Before

Width: 839  |  Height: 620  |  Size: 42 KiB

After

Width: 1420  |  Height: 800  |  Size: 62 KiB

BIN
muk_web_client_refresh/static/description/screenshot_view.png

Before

Width: 839  |  Height: 620  |  Size: 23 KiB

After

Width: 1420  |  Height: 800  |  Size: 53 KiB

47
muk_web_client_refresh/static/src/js/client_refresh.js

@ -22,30 +22,45 @@ odoo.define('muk_web_client_refresh.channel', function (require) {
var WebClient = require('web.WebClient'); var WebClient = require('web.WebClient');
var session = require('web.session'); var session = require('web.session');
var bus = require('bus.bus')
var config = require('web.config');
var bus = require('bus.bus');
var utils = require('muk_web_utils.common');
WebClient.include({ WebClient.include({
start: function () {
var self = this;
var load_config = this._rpc({
route: '/config/muk_web_client_refresh.refresh_delay',
}).done(function(result) {
self.refresh_delay = result.refresh_delay;
});
return $.when(this._super.apply(this, arguments), load_config);
},
show_application: function() { show_application: function() {
var channel = 'refresh'; var channel = 'refresh';
this.bus_declare_channel(channel, this.refresh); this.bus_declare_channel(channel, this.refresh);
return this._super();
return this._super.apply(this, arguments);
}, },
refresh: function(message) { refresh: function(message) {
var widget = this.action_manager.inner_widget;
var active_view = widget ? widget.active_view : false;
if (active_view && message instanceof Array && message.length === 3) {
var message = message[1];
var controller = this.action_manager.inner_widget.active_view.controller
if (controller.modelName === message &&
!controller.$el.hasClass('o_form_editable')){
controller.reload();
} else if((message === "mail.message" || message === "mail.activity") &&
!controller.$el.hasClass('o_form_editable') &&
active_view.type === "form") {
controller.reload();
var self = this;
utils.delay(function() {
var widget = self.action_manager && self.action_manager.inner_widget;
var active_view = widget ? widget.active_view : false;
if (active_view && message.uid && session.uid !== message.uid) {
var controller = self.action_manager.inner_widget.active_view.controller;
if(controller.modelName === message.model && controller.mode === "readonly") {
if(active_view.type === "form" && message.ids.includes(widget.env.currentId)) {
controller.reload();
} else if(active_view.type === "list") {
controller.reload();
} else if(active_view.type === "kanban") {
controller.reload();
}
}
} }
}
}
}, self.refresh_delay || 1000);
},
}); });
}); });

82
muk_web_client_refresh/views/refresh_action_view.xml

@ -0,0 +1,82 @@
<?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>
<record id="view_client_refresh_actions_form" model="ir.ui.view">
<field name="name">base.automation.form</field>
<field name="model">base.automation</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="base_automation.view_base_automation_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="placeholder">e.g. Refresh Users on Create</attribute>
</xpath>
<xpath expr="//field[@name='state']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
<xpath expr="//field[@name='code']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
<record id="view_client_refresh_actions_tree" model="ir.ui.view">
<field name="name">base.automation.tree</field>
<field name="model">base.automation</field>
<field name="arch" type="xml">
<tree string="Automation">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="trigger"/>
<field name="model_id"/>
</tree>
</field>
</record>
<record id="action_client_refresh_actions" model="ir.actions.act_window">
<field name="name">Automated Refresh</field>
<field name="res_model">base.automation</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">
[
['code', '=', 'env["bus.bus"].sendone("refresh", {"model": model._name, "uid": env.user.id, "ids": (record | records).mapped("id")})']
]
</field>
<field name="context">
{
'default_state': 'code',
'default_code': 'env["bus.bus"].sendone("refresh", {"model": model._name, "uid": env.user.id, "ids": (record | records).mapped("id")})'
}
</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to setup a new automated refresh action.
</p>
</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_client_refresh_actions_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_client_refresh_actions_form')})]"/>
</record>
<menuitem id="menu_client_refresh_actions" parent="base.menu_automation"
action="action_client_refresh_actions" sequence="2"/>
</odoo>

41
muk_web_client_refresh/views/res_config_settings_view.xml

@ -0,0 +1,41 @@
<?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>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
<field name="arch" type="xml">
<div id="msg_module_muk_web_client_refresh" position="replace">
<div class="content-group" attrs="{'invisible': [('module_muk_web_client_refresh','=',False)]}">
<button name="%(muk_web_client_refresh.action_client_refresh_actions)d"
string="Configure Actions" type="action" class="oe_link" icon="fa-arrow-right"/>
<div class="mt16 row">
<label for="refresh_delay" string="Delay" class="col-xs-3 col-md-3 o_light_label"/>
<field name="refresh_delay" nolabel="1"/>
</div>
</div>
</div>
</field>
</record>
</odoo>

3
muk_web_utils/README.md

@ -1,3 +0,0 @@
# MuK Web Utils
Technical module to provide some utility features.

2
muk_web_utils/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2018 MuK IT GmbH # Copyright (C) 2018 MuK IT GmbH

10
muk_web_utils/__manifest__.py

@ -1,5 +1,3 @@
## -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2018 MuK IT GmbH # Copyright (C) 2018 MuK IT GmbH
@ -22,13 +20,11 @@
{ {
"name": "MuK Web Utils", "name": "MuK Web Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"description": """
Technical module to provide some utility features.
""",
"version": "11.0.1.0.4",
"version": "11.0.2.0.0",
"category": "Extra Tools", "category": "Extra Tools",
"license": "AGPL-3", "license": "AGPL-3",
"website": "http://www.mukit.at", "website": "http://www.mukit.at",
"live_test_url": "https://demo.mukit.at/web/login",
"author": "MuK IT", "author": "MuK IT",
"contributors": [ "contributors": [
"Mathias Markl <mathias.markl@mukit.at>", "Mathias Markl <mathias.markl@mukit.at>",
@ -40,8 +36,6 @@
"data": [ "data": [
"template/assets.xml", "template/assets.xml",
], ],
"demo": [
],
"qweb": [ "qweb": [
"static/src/xml/*.xml", "static/src/xml/*.xml",
], ],

5
muk_web_utils/doc/changelog.rst

@ -1,3 +1,8 @@
`2.0.0`
-------
- Migrated to Python 3
`1.0.0` `1.0.0`
------- -------

46
muk_web_utils/doc/index.rst

@ -0,0 +1,46 @@
=============
MuK Web Utils
=============
Technical module to provide some utility features and libraries that can be used
in other applications. This module has no direct effect on the running system.
Installation
============
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to
your Odoo server and go to the Apps menu. Trigger the debug modus and update the
list by clicking on the "Update Apps List" link. Now install the module by
clicking on the install button.
Configuration
=============
No additional configuration is needed to use this module.
Usage
=============
This module has no direct visible effect on the system. It provide utility features.
Credits
=======
Contributors
------------
* Mathias Markl <mathias.markl@mukit.at>
Author & Maintainer
-------------------
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_.
MuK IT is an Austrian company specialized in customizing and extending Odoo.
We develop custom solutions for your individual needs to help you focus on
your strength and expertise to grow your business.
If you want to get in touch please contact us via mail
(sale@mukit.at) or visit our website (https://mukit.at).

39
muk_web_utils/static/description/index.html

@ -9,23 +9,56 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_picture">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Overview</h3> <h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32">Technical module to provide some utility <p class="oe_mt32">Technical module to provide some utility
features. The module is mainly used as a dependency by other
modules and to provide a collection of common libraries.</p>
features. The module is mainly used as a dependency by other modules
and to provide a collection of common libraries. It has no direct
visible effect on the system.</p>
</div> </div>
</div> </div>
</section> </section>
<section class="oe_container oe_dark"
style="margin-bottom: 20px; border-top: 5px solid #797979; border-bottom: 5px solid #797979;">
<h3 class="oe_slogan" style="margin-bottom: 10px;">Demo</h3>
<div class="row" style="margin: auto; max-width: 200px;">
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">User:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">apps</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">Password:</h5>
</div>
<div class="col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">demo</h5>
</div>
</div>
<div class="oe_slogan" style="margin-top: 5px;">
<a class="btn btn-primary btn-lg mt8"
href="https://demo.mukit.at/web/login"
style="position: relative; overflow: hidden;"><span
class="o_ripple"
style="height: 138px; width: 138px; top: -35.2969px; left: -8.17188px;"></span>
<i class="fa fa-video-camera"></i> Live Preview </a>
</div>
</section>
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<h3 class="oe_slogan">Help and Support</h3> <h3 class="oe_slogan">Help and Support</h3>
<h5 class="oe_slogan" style="font-size: 20px;">Feel free to
contact us, if you need any help with your Odoo integration or
addiontal features.</h5>
<div class="oe_slogan"> <div class="oe_slogan">
<a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at"> <a class="btn btn-primary btn-lg mt8" href="mailto:sale@mukit.at">
<i class="fa fa-envelope"></i> Email <i class="fa fa-envelope"></i> Email
</a> <a class="btn btn-primary btn-lg mt8" </a> <a class="btn btn-primary btn-lg mt8"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i> href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact Contact
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support
</a> </a>
</div> </div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;" <img src="logo.png" style="width: 200px; margin-bottom: 20px;"

2
muk_web_utils/static/src/js/common.js

@ -46,7 +46,7 @@ function format_number(value) {
} }
function format_size(bytes, options) { function format_size(bytes, options) {
var options = options || {}
var options = options || {};
var thresh = options.si ? 1000 : 1024; var thresh = options.si ? 1000 : 1024;
if(Math.abs(bytes) < thresh) { if(Math.abs(bytes) < thresh) {
return format_number(bytes) + ' B'; return format_number(bytes) + ' B';

34
muk_web_utils/static/src/js/mimetype.js

@ -55,53 +55,53 @@ var mapping = [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
]], ]],
['file-o' ] ['file-o' ]
]
];
function match(mimetype, cond) { function match(mimetype, cond) {
if (Array.isArray(cond)) { if (Array.isArray(cond)) {
return cond.reduce(function(v, c) { return cond.reduce(function(v, c) {
return v || match(mimetype, c)
}, false)
return v || match(mimetype, c);
}, false);
} else if (cond instanceof RegExp) { } else if (cond instanceof RegExp) {
return cond.test(mimetype)
return cond.test(mimetype);
} else if (cond === undefined) { } else if (cond === undefined) {
return true
return true;
} else { } else {
return mimetype === cond
return mimetype === cond;
} }
} }
var cache = {}
var cache = {};
function resolve(mimetype) { function resolve(mimetype) {
if (cache[mimetype]) { if (cache[mimetype]) {
return cache[mimetype]
return cache[mimetype];
} }
for (var i = 0; i < mapping.length; i++) { for (var i = 0; i < mapping.length; i++) {
if (match(mimetype, mapping[i][1])) { if (match(mimetype, mapping[i][1])) {
cache[mimetype] = mapping[i][0]
return mapping[i][0]
cache[mimetype] = mapping[i][0];
return mapping[i][0];
} }
} }
} }
function mimetype2fa(mimetype, options) { function mimetype2fa(mimetype, options) {
if (typeof mimetype === 'object') { if (typeof mimetype === 'object') {
options = mimetype
options = mimetype;
return function(mimetype) { return function(mimetype) {
return mimetype2fa(mimetype, options)
}
return mimetype2fa(mimetype, options);
};
} else { } else {
var icon = resolve(mimetype)
var icon = resolve(mimetype);
if (icon && options && options.prefix) { if (icon && options && options.prefix) {
return options.prefix + icon
return options.prefix + icon;
} else { } else {
return icon
return icon;
} }
} }
} }
return { return {
mimetype2fa: mimetype2fa, mimetype2fa: mimetype2fa,
}
};
}); });

3
muk_web_utils/tests/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -20,4 +18,3 @@
################################################################################### ###################################################################################
from . import test_utils from . import test_utils

12
muk_web_utils/tests/test_utils.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################### ###################################################################################
# #
# Copyright (C) 2017 MuK IT GmbH # Copyright (C) 2017 MuK IT GmbH
@ -19,14 +17,12 @@
# #
################################################################################### ###################################################################################
import os
import base64
import logging import logging
import unittest
from odoo import _
from odoo.tests import common from odoo.tests import common
_logger = logging.getLogger(__name__)
class UtilsTestCase(common.HttpCase): class UtilsTestCase(common.HttpCase):
at_install = False at_install = False
@ -41,9 +37,9 @@ class UtilsTestCase(common.HttpCase):
def test_common(self): def test_common(self):
self.phantom_js('/web/tests?filter=utils%20>%20common', "", "", login='admin', timeout=360) self.phantom_js('/web/tests?filter=utils%20>%20common', "", "", login='admin', timeout=360)
def test_common(self):
def test_jquery(self):
self.phantom_js('/web/tests?filter=utils%20>%20jquery', "", "", login='admin', timeout=360) self.phantom_js('/web/tests?filter=utils%20>%20jquery', "", "", login='admin', timeout=360)
def test_common(self):
def test_mimetype(self):
self.phantom_js('/web/tests?filter=utils%20>%20mimetype', "", "", login='admin', timeout=360) self.phantom_js('/web/tests?filter=utils%20>%20mimetype', "", "", login='admin', timeout=360)
Loading…
Cancel
Save