summaryrefslogtreecommitdiff
path: root/addons/timer/static/src/js/timer.js
diff options
context:
space:
mode:
authorjbm-odoo <jbm@odoo.com>2020-06-05 17:13:53 +0200
committerjbm-odoo <jbm@odoo.com>2020-06-15 15:51:20 +0200
commitd6a23144d5c5b85c2a02097bcbb3e006a9c2c52a (patch)
tree2eb930372884160d675497ce415279374d21b48a /addons/timer/static/src/js/timer.js
parente7dda3fab002f5db930b4af340787177d597d59e (diff)
[MOV] timer: Move to Enterprise
taskId: 2217930
Diffstat (limited to 'addons/timer/static/src/js/timer.js')
-rw-r--r--addons/timer/static/src/js/timer.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/addons/timer/static/src/js/timer.js b/addons/timer/static/src/js/timer.js
deleted file mode 100644
index 0042ebfaead..00000000000
--- a/addons/timer/static/src/js/timer.js
+++ /dev/null
@@ -1,63 +0,0 @@
-odoo.define('timer.timer', function (require) {
-"use strict";
-
-var fieldRegistry = require('web.field_registry');
-var AbstractField = require('web.AbstractField');
-var Timer = require('timer.Timer');
-
-var TimerFieldWidget = AbstractField.extend({
-
- /**
- * @override
- * @private
- */
- isSet: function () {
- return true;
- },
- /**
- * @override
- * @private
- */
- _render: function () {
- this._super.apply(this, arguments);
- this._startTimeCounter();
- },
- /**
- * @override
- */
- destroy: function () {
- this._super.apply(this, arguments);
- clearInterval(this.timer);
- },
- /**
- * @private
- */
- _startTimeCounter: async function () {
- if (this.record.data.timer_start) {
- const serverTime = this.record.data.timer_pause || await this._getServerTime();
- this.time = Timer.createTimer(0, this.record.data.timer_start, serverTime);
- this.$el.text(this.time.toString());
- this.timer = setInterval(() => {
- if (this.record.data.timer_pause) {
- clearInterval(this.timer);
- } else {
- this.time.addSecond();
- this.$el.text(this.time.toString());
- }
- }, 1000);
- } else if (!this.record.data.timer_pause){
- clearInterval(this.timer);
- }
- },
- _getServerTime: function () {
- return this._rpc({
- model: 'timer.timer',
- method: 'get_server_time',
- args: []
- });
- }
-});
-
-fieldRegistry.add('timer_timer', TimerFieldWidget);
-
-});