Browse Source

publish muk_web_client_refresh - 12.0

pull/35/head
MuK IT GmbH 6 years ago
parent
commit
17bb1d228f
  1. 7
      muk_web_client_refresh/data/refresh_actions.xml
  2. 87
      muk_web_client_refresh/static/description/index.html
  3. 13
      muk_web_client_refresh/static/src/js/client_refresh.js

7
muk_web_client_refresh/data/refresh_actions.xml

@ -40,11 +40,4 @@
<field name="trigger">on_unlink</field> <field name="trigger">on_unlink</field>
</record> </record>
<record id="base_automation_refresh_partner_on_create_or_write" model="base.automation">
<field name="name">Refresh Users on Creation/Update</field>
<field name="model_id" ref="base.model_res_users" />
<field name="state">refresh</field>
<field name="trigger">on_create_or_write</field>
</record>
</odoo> </odoo>

87
muk_web_client_refresh/static/description/index.html

@ -15,7 +15,7 @@
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div style="max-width: 84%; margin: 16px 8%;"> <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 channel called "refresh"
<p class="oe_mt32">Adds a channel called "refresh"
to the web client, which can be used to trigger a view reload to the web client, which can be used to trigger a view reload
without refreshing the browser itself. Furthermore, it allows the without refreshing the browser itself. Furthermore, it allows the
user the creation of action rules. These rules can be applied to any user the creation of action rules. These rules can be applied to any
@ -26,9 +26,11 @@
<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">
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Customize Process</h3>
<div class="row">
<div class="mb16 col-lg-6">
<p>
Refresh actions can be created easily inside of Odoo. The view to Refresh actions can be created easily inside of Odoo. The view to
create such rules is located under "Settings" <i 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> "Technical" <i
@ -36,51 +38,60 @@
class="fa fa-arrow-right" aria-hidden="true"></i> "Automated class="fa fa-arrow-right" aria-hidden="true"></i> "Automated
Refresh". Refresh".
</p> </p>
</div>
<div class="oe_span6">
<img class="oe_picture oe_screenshot" src="screenshot_view.png">
</div>
<div class="mb16 col-lg-6">
<div class="oe_demo oe_screenshot">
<img src="screenshot_view.png">
</div>
</div>
</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>
<div class="oe_span6">
<p class="oe_mt32 text-justify">The module also has support for
<div style="max-width: 84%; margin: 16px 8%;">
<h3 class="oe_slogan">Customize Process</h3>
<div class="row">
<div class="mb16 col-lg-6">
<div class="oe_demo oe_screenshot">
<img src="screenshot_chatter.png">
</div>
</div>
<div class="mb16 col-lg-6">
<p>The module also has support for
the Odoo Chatter Widget. As soon as a new message or activity is the Odoo Chatter Widget. As soon as a new message or activity is
created, a corresponding refresh message is sent.</p> created, a corresponding refresh message is sent.</p>
</div>
</div>
</div> </div>
</div> </div>
</section> </section>
<section class="oe_container oe_dark" <section class="oe_container oe_dark"
style="margin-bottom: 20px; border-top: 5px solid #797979; border-bottom: 5px solid #797979;"> 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>
<h3 class="oe_slogan" style="margin-bottom: 10px;">Demo</h3>
<div class="row" style="margin: auto; max-width: 250px;">
<div class="col-6 col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">User:</h5>
</div>
<div class="col-6 col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">apps</h5>
</div>
<div class="col-6 col-xs-6">
<h5 class="oe_slogan" style="font-size: 20px; margin: 2px;">Password:</h5>
</div>
<div class="col-6 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;"> <div class="oe_slogan" style="margin-top: 5px;">
<a class="btn btn-primary btn-lg mt8" <a class="btn btn-primary btn-lg mt8"
href="https://demo.mukit.at/web/login" 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>
style="position: relative; overflow: hidden;">
<i class="fa fa-video-camera"></i> Live Preview
</a>
</div> </div>
</section> </section>
@ -92,13 +103,13 @@
<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"
href="https://mukit.at/page/contactus"> <i class="fa fa-phone"></i>
Contact
</a> <a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
</a>
<a class="btn btn-primary btn-lg mt8" href="https://mukit.at/page/contactus">
<i class="fa fa-phone"></i> Contact
</a>
<a class="btn btn-primary btn-lg mt8" href="mailto:support@mukit.at">
<i class="fa fa-life-ring"></i> Support <i class="fa fa-life-ring"></i> Support
</a> </a>
</div> </div>
<img src="logo.png" style="width: 200px; margin-bottom: 20px;"
class="center-block">
<img src="logo.png" style="width: 200px; margin-bottom: 20px; display: block;" class="mx-auto center-block">
</section> </section>

13
muk_web_client_refresh/static/src/js/client_refresh.js

@ -24,6 +24,7 @@ var config = require('web.config');
var session = require('web.session'); var session = require('web.session');
var WebClient = require('web.WebClient'); var WebClient = require('web.WebClient');
var BusService = require('bus.BusService');
WebClient.include({ WebClient.include({
start: function () { start: function () {
@ -31,12 +32,13 @@ WebClient.include({
var load_config = this._rpc({ var load_config = this._rpc({
route: '/config/muk_web_client_refresh.refresh_delay', route: '/config/muk_web_client_refresh.refresh_delay',
}).done(function(result) { }).done(function(result) {
self.refresh = _.throttle(self.refresh.bind(self), result.refresh_delay || 1000, true);
self.refresh_delay = result.refresh_delay;
self._reload = _.throttle(self._reload, self.refresh_delay || 1000);
}); });
return $.when(this._super.apply(this, arguments), load_config); return $.when(this._super.apply(this, arguments), load_config);
}, },
show_application: function() { show_application: function() {
this.bus_declare_channel('refresh', this.refresh);
this.bus_declare_channel('refresh', this.refresh.bind(this));
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
refresh: function(message) { refresh: function(message) {
@ -46,12 +48,15 @@ WebClient.include({
action && controller && controller.widget.modelName === message.model && action && controller && controller.widget.modelName === message.model &&
controller.widget.mode === "readonly") { controller.widget.mode === "readonly") {
if(controller.widget.isMultiRecord && (message.create || _.intersection(message.ids, action.env.ids) >= 1)) { if(controller.widget.isMultiRecord && (message.create || _.intersection(message.ids, action.env.ids) >= 1)) {
controller.widget.reload();
this._reload(message, controller);
} else if(!controller.widget.isMultiRecord && message.ids.includes(action.env.currentId)) { } else if(!controller.widget.isMultiRecord && message.ids.includes(action.env.currentId)) {
controller.widget.reload();
this._reload(message, controller);
} }
} }
}, },
_reload: function(controller) {
controller.widget.reload();
},
}); });
}); });
Loading…
Cancel
Save