odoo-addon-web-widget-remote-measure 15.0.1.1.0.2__py3-none-any.whl → 17.0.1.0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/web_widget_remote_measure/README.rst +37 -32
- odoo/addons/web_widget_remote_measure/__manifest__.py +2 -4
- odoo/addons/web_widget_remote_measure/i18n/es.po +11 -59
- odoo/addons/web_widget_remote_measure/i18n/web_widget_remote_measure.pot +40 -28
- odoo/addons/web_widget_remote_measure/models/__init__.py +1 -0
- odoo/addons/web_widget_remote_measure/models/remote_measure_device.py +1 -1
- odoo/addons/web_widget_remote_measure/models/res_users.py +2 -0
- odoo/addons/web_widget_remote_measure/models/res_users_settings.py +10 -0
- odoo/addons/web_widget_remote_measure/readme/CONFIGURE.md +9 -0
- odoo/addons/web_widget_remote_measure/readme/CONTRIBUTORS.md +4 -0
- odoo/addons/web_widget_remote_measure/readme/{DESCRIPTION.rst → DESCRIPTION.md} +3 -3
- odoo/addons/web_widget_remote_measure/readme/USAGE.md +22 -0
- odoo/addons/web_widget_remote_measure/static/description/index.html +23 -18
- odoo/addons/web_widget_remote_measure/static/src/remote_measure_field/remote_measure_field.esm.js +428 -0
- odoo/addons/web_widget_remote_measure/static/src/{scss/remote_measure_widget.scss → remote_measure_field/remote_measure_field.scss} +3 -3
- odoo/addons/web_widget_remote_measure/static/src/remote_measure_field/remote_measure_field.xml +43 -0
- odoo/addons/web_widget_remote_measure/views/remote_measure_device_views.xml +9 -3
- {odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info → odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info}/METADATA +42 -37
- odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info/RECORD +31 -0
- {odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info → odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info}/WHEEL +1 -1
- odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info/top_level.txt +1 -0
- odoo/addons/web_widget_remote_measure/readme/CONFIGURE.rst +0 -8
- odoo/addons/web_widget_remote_measure/readme/CONTRIBUTORS.rst +0 -5
- odoo/addons/web_widget_remote_measure/readme/USAGE.rst +0 -19
- odoo/addons/web_widget_remote_measure/static/src/js/remote_measure_device_kanban_widget.esm.js +0 -33
- odoo/addons/web_widget_remote_measure/static/src/js/remote_measure_widget.esm.js +0 -461
- odoo/addons/web_widget_remote_measure/static/src/xml/measure_device_status.xml +0 -15
- odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info/RECORD +0 -31
- odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info/top_level.txt +0 -1
- /odoo/addons/web_widget_remote_measure/readme/{ROADMAP.rst → ROADMAP.md} +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
odoo/addons/web_widget_remote_measure/README.rst,sha256=3FF2HnCz1_vPNU-Dlg-FlnsRBTXIjZMyE3xvsZafIvM,4967
|
2
|
+
odoo/addons/web_widget_remote_measure/__init__.py,sha256=jQ-fltIs1ohXt7udDkkJwzh7ckauQW2rbmv1Wtg3SjQ,47
|
3
|
+
odoo/addons/web_widget_remote_measure/__manifest__.py,sha256=hCh8rzyN8bkBnWMCVFn4FIuA4vEJgAfvOF7R3cPFlJU,813
|
4
|
+
odoo/addons/web_widget_remote_measure/controllers/__init__.py,sha256=4KFqEP2QHFbPN66eQJMdGsmNz2v7ywWv_FR1pW_kkLk,19
|
5
|
+
odoo/addons/web_widget_remote_measure/controllers/main.py,sha256=Y7-KWYAzJUsFOUXp8pYb6gubSRPjYaMMTK-EwPvf-FM,1596
|
6
|
+
odoo/addons/web_widget_remote_measure/i18n/es.po,sha256=tBibgxH962Oq4YU4sTGdwXDsM7dhcGpm6Z6geEqvTK8,9556
|
7
|
+
odoo/addons/web_widget_remote_measure/i18n/web_widget_remote_measure.pot,sha256=iqMYQh__b4HyIdXwLlTv-BlzU57UpNWmxvu7gRwSPto,10560
|
8
|
+
odoo/addons/web_widget_remote_measure/models/__init__.py,sha256=GitP5NH0atng0Ne-1UMlk2wJttcTGYq1VB1PXaLHMMI,93
|
9
|
+
odoo/addons/web_widget_remote_measure/models/remote_measure_device.py,sha256=qQL0Emwfy359bjAz5WWQHW6YR432QxJxypwebD6z3yk,2690
|
10
|
+
odoo/addons/web_widget_remote_measure/models/res_users.py,sha256=Bh7f5amhqx_6z7ZiaOgNOOIRamUamorH-MPZAmnMTTI,575
|
11
|
+
odoo/addons/web_widget_remote_measure/models/res_users_settings.py,sha256=ymm0lW1hOz3pH6Jr4MNPK6fTx6Rcb_ag9sExf9CN6r8,269
|
12
|
+
odoo/addons/web_widget_remote_measure/readme/CONFIGURE.md,sha256=9oEIl0wWsfZ4Guo0H3gTLrfPS7b0nc9FFSkq9jdJ0Cs,387
|
13
|
+
odoo/addons/web_widget_remote_measure/readme/CONTRIBUTORS.md,sha256=jgNZX60tb8GjlCx7AMshTFqJb1OI0zR4pQ6RQQdtAqI,92
|
14
|
+
odoo/addons/web_widget_remote_measure/readme/DESCRIPTION.md,sha256=ZlyTa5gqXwapdq09Y2eu_Aht_hl7S1sSRON_0iPR2MA,241
|
15
|
+
odoo/addons/web_widget_remote_measure/readme/ROADMAP.md,sha256=Z0aICtUk3GUOPY5NVUo4TRyWbtmVHRfzJZrVvFzvBb8,251
|
16
|
+
odoo/addons/web_widget_remote_measure/readme/USAGE.md,sha256=gzGva_5GUwyqAnWkmZgBt22TuoWEZJQLykVdJACWdPY,849
|
17
|
+
odoo/addons/web_widget_remote_measure/security/ir.model.access.csv,sha256=3bwXFcGN-56-3-aR-RYGH8G6sVnuYkirAzpY4dDu8IA,426
|
18
|
+
odoo/addons/web_widget_remote_measure/security/security.xml,sha256=1lW2jowKe0fu9fRj-dPZt0-2q70c4VQKxBBHSAzE7L0,264
|
19
|
+
odoo/addons/web_widget_remote_measure/static/description/icon.png,sha256=O9NGHv3egMV4Z7wp_y1yxXS9BmUi7AiGAleQTwMkuRo,9652
|
20
|
+
odoo/addons/web_widget_remote_measure/static/description/index.html,sha256=_OY-_6xCreHEK1IPhRfEKbNCHI0-ezpLG3a5X6_J9b0,15484
|
21
|
+
odoo/addons/web_widget_remote_measure/static/src/js/systray_device_selector.esm.js,sha256=GeAoxLPc8u6Kgx7kdb34fWa3il5uyxFnroD5q5hfRi4,1372
|
22
|
+
odoo/addons/web_widget_remote_measure/static/src/remote_measure_field/remote_measure_field.esm.js,sha256=CMFcLaRdixaL_gA-u7PPFBUn32YQr7Bbi-0FJGvtM-4,13325
|
23
|
+
odoo/addons/web_widget_remote_measure/static/src/remote_measure_field/remote_measure_field.scss,sha256=mx7m6mdB37R0JQJZuhgBS_QQd2CmJMHf5K6eaEJSmIU,646
|
24
|
+
odoo/addons/web_widget_remote_measure/static/src/remote_measure_field/remote_measure_field.xml,sha256=CpOi8noxkk_k0-HDZ6JuHLN9zDh82u_4iUJD_Lsr84M,1730
|
25
|
+
odoo/addons/web_widget_remote_measure/static/src/xml/systray_device_selector.xml,sha256=LZIlsnhgzCDFnZRtTZc2okAPQC4qoxoe0Khi1oDzU_c,692
|
26
|
+
odoo/addons/web_widget_remote_measure/views/remote_measure_device_views.xml,sha256=IQvLFqeiitZ8pBu4A6Fg4w_9dxD4zJ-G3cVPFxaH-xc,4821
|
27
|
+
odoo/addons/web_widget_remote_measure/views/res_users_views.xml,sha256=QqvjaLWw1eEWJc8nShScpi-OcPeg7QV8OoqVnEOgJWY,2315
|
28
|
+
odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info/METADATA,sha256=OcR6Cc85Fddis0hOL-hcWiuHk8oGONCHoCy5dMmJY1A,5524
|
29
|
+
odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
|
30
|
+
odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
|
31
|
+
odoo_addon_web_widget_remote_measure-17.0.1.0.0.4.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
odoo
|
@@ -1,8 +0,0 @@
|
|
1
|
-
To configure your remote devices:
|
2
|
-
|
3
|
-
#. Go to *Settings > Technical > Devices > Remote devices*
|
4
|
-
#. Create a new one configuring the required info.
|
5
|
-
#. If the devices has an special port, set it up in the host data: e.g.: 10.1.1.2:3210
|
6
|
-
|
7
|
-
If you want to see the button in the top bar to set the user's remote device, you need
|
8
|
-
to have the "Show remote device button on navbar" group.
|
@@ -1,19 +0,0 @@
|
|
1
|
-
The remote device has to be in the users network so their web clients can reach them.
|
2
|
-
|
3
|
-
In order to test a device you can:
|
4
|
-
|
5
|
-
#. Go to *Settings > Technical > Devices > Remote devices*
|
6
|
-
#. In the Kanban view you'll wich devices can be reached as they'll have a green dot in
|
7
|
-
their card.
|
8
|
-
#. Go to one of those and click *Edit*.
|
9
|
-
#. You can start measuring from the remote device in the *Test measure* field.
|
10
|
-
|
11
|
-
On the technical side, you can use the widget in your own `Float``. You'll need to
|
12
|
-
provide an uom field so records that aren't in that UoM don't measure from the device.
|
13
|
-
|
14
|
-
.. code:: xml
|
15
|
-
|
16
|
-
<field name="float_field" widget="remote_measure" options="{'remote_device_field': 'measure_device_id', 'uom_field': 'uom_id'}" />
|
17
|
-
|
18
|
-
The users are able to change their default remote device by using the button with the
|
19
|
-
balance icon set on the navbar.
|
odoo/addons/web_widget_remote_measure/static/src/js/remote_measure_device_kanban_widget.esm.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
/** @odoo-module **/
|
2
|
-
import Widget from "web.Widget";
|
3
|
-
import widgetRegistry from "web.widget_registry";
|
4
|
-
|
5
|
-
const RemoteMeasureDeviceStatusWidget = Widget.extend({
|
6
|
-
template: "web_widget_remote_measure.measure_device_status",
|
7
|
-
xmlDependencies: [
|
8
|
-
"/web_widget_remote_measure/static/src/xml/measure_device_status.xml",
|
9
|
-
],
|
10
|
-
init(_parent, _data, options) {
|
11
|
-
this._super(...arguments);
|
12
|
-
this.className = "text-muted";
|
13
|
-
this.title = "Requesting status...";
|
14
|
-
this.host = options.attrs.host;
|
15
|
-
},
|
16
|
-
async willStart() {
|
17
|
-
await this._super(...arguments);
|
18
|
-
const socket = new WebSocket(this.host);
|
19
|
-
socket.onerror = async () => {
|
20
|
-
this.className = "text-danger";
|
21
|
-
this.title = "Device is down";
|
22
|
-
this.renderElement();
|
23
|
-
};
|
24
|
-
socket.onmessage = async () => {
|
25
|
-
socket.close();
|
26
|
-
this.className = "text-success";
|
27
|
-
this.title = "Device ready";
|
28
|
-
this.renderElement();
|
29
|
-
};
|
30
|
-
},
|
31
|
-
});
|
32
|
-
|
33
|
-
widgetRegistry.add("remote_measure_device_status", RemoteMeasureDeviceStatusWidget);
|
@@ -1,461 +0,0 @@
|
|
1
|
-
/** @odoo-module **/
|
2
|
-
// TODO: Implement in OWL in v16. It should have be a much much simpler implementation.
|
3
|
-
import {FieldFloat} from "web.basic_fields";
|
4
|
-
import {_lt} from "@web/core/l10n/translation";
|
5
|
-
import {_t} from "web.translation";
|
6
|
-
import fieldRegistry from "web.field_registry";
|
7
|
-
import session from "web.session";
|
8
|
-
|
9
|
-
// Animate the measure steps for each measure received.
|
10
|
-
export const nextState = {
|
11
|
-
"fa-thermometer-empty": "fa-thermometer-quarter",
|
12
|
-
"fa-thermometer-quarter": "fa-thermometer-half",
|
13
|
-
"fa-thermometer-half": "fa-thermometer-three-quarters",
|
14
|
-
"fa-thermometer-three-quarters": "fa-thermometer-full",
|
15
|
-
"fa-thermometer-full": "fa-thermometer-empty",
|
16
|
-
};
|
17
|
-
|
18
|
-
export const RemoteMeasureMixin = {
|
19
|
-
/**
|
20
|
-
* F501 Protocol response:
|
21
|
-
* [STX][status1][status2][data][ETX]
|
22
|
-
* - status1 beign weight status: \x20 (space) for stable weight and ? for unstable
|
23
|
-
* - status2 beign weight sign: + for positive and - for negative.
|
24
|
-
* - data being the weight itself with 6 characters for weight and one . for the
|
25
|
-
* decimal dot
|
26
|
-
*
|
27
|
-
* @param {String} msg ASCII string
|
28
|
-
* @returns {Object} with the value and the stable flag
|
29
|
-
*/
|
30
|
-
_proccess_msg_f501(msg) {
|
31
|
-
return {
|
32
|
-
stable: msg[1] === "\x20",
|
33
|
-
value: parseFloat(msg.slice(2, 10)),
|
34
|
-
};
|
35
|
-
},
|
36
|
-
/**
|
37
|
-
* Implemented for a continous remote stream
|
38
|
-
* TODO: Abstract more the possible device scenarios
|
39
|
-
*/
|
40
|
-
_connect_to_websockets() {
|
41
|
-
try {
|
42
|
-
this.socket = new WebSocket(this.host);
|
43
|
-
} catch (error) {
|
44
|
-
// Avoid websockets security error. Local devices won't have wss normally
|
45
|
-
if (error.code === 18) {
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
throw error;
|
49
|
-
}
|
50
|
-
var icon = "fa-thermometer-empty";
|
51
|
-
var stream_success_counter = 10;
|
52
|
-
this.socket.onmessage = async (msg) => {
|
53
|
-
const data = await msg.data.text();
|
54
|
-
const processed_data = this[`_proccess_msg_${this.protocol}`](data);
|
55
|
-
if (!processed_data.stable) {
|
56
|
-
stream_success_counter = 5;
|
57
|
-
}
|
58
|
-
if (processed_data.stable && !stream_success_counter) {
|
59
|
-
this._stableMeasure();
|
60
|
-
this._closeSocket();
|
61
|
-
this._awaitingMeasure();
|
62
|
-
this._recordMeasure();
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
this._unstableMeasure();
|
66
|
-
|
67
|
-
if (stream_success_counter) {
|
68
|
-
--stream_success_counter;
|
69
|
-
}
|
70
|
-
icon = this._nextStateIcon(icon);
|
71
|
-
this.amount = processed_data.value;
|
72
|
-
this._setMeasure();
|
73
|
-
};
|
74
|
-
this.socket.onerror = () => {
|
75
|
-
this._awaitingMeasure();
|
76
|
-
};
|
77
|
-
},
|
78
|
-
/**
|
79
|
-
* Implement for your device protocol service
|
80
|
-
*/
|
81
|
-
_connect_to_webservices() {
|
82
|
-
return;
|
83
|
-
},
|
84
|
-
/**
|
85
|
-
* Send read params to the remote device
|
86
|
-
* @returns {Object}
|
87
|
-
*/
|
88
|
-
_read_from_device_tcp_params() {
|
89
|
-
return {command: false};
|
90
|
-
},
|
91
|
-
/**
|
92
|
-
* Process call
|
93
|
-
* @returns {Number}
|
94
|
-
*/
|
95
|
-
async _read_from_device_tcp() {
|
96
|
-
const data = await this._rpc({
|
97
|
-
route: `/remote_measure_device/${this.remote_device_data.id}` || [],
|
98
|
-
params: this._read_from_device_tcp_params(),
|
99
|
-
});
|
100
|
-
if (!data) {
|
101
|
-
return null;
|
102
|
-
}
|
103
|
-
const processed_data = this[`_proccess_msg_${this.protocol}`](data);
|
104
|
-
if (isNaN(processed_data.value)) {
|
105
|
-
processed_data.value = 0;
|
106
|
-
}
|
107
|
-
return processed_data;
|
108
|
-
},
|
109
|
-
/**
|
110
|
-
* Connect to the local controller, which makes the direct connection to the
|
111
|
-
* scale.
|
112
|
-
*/
|
113
|
-
async _connect_to_tcp() {
|
114
|
-
var icon = "fa-thermometer-empty";
|
115
|
-
var stream_success_counter = 20;
|
116
|
-
this._unstableMeasure();
|
117
|
-
// Used to set the read interval if any
|
118
|
-
const timer = (ms) => new Promise((res) => setTimeout(res, ms));
|
119
|
-
// Don't keep going forever unless non stop reading
|
120
|
-
for (
|
121
|
-
let attemps_left = this.remote_device_data.non_stop_read ? Infinity : 1000;
|
122
|
-
attemps_left > 0;
|
123
|
-
attemps_left--
|
124
|
-
) {
|
125
|
-
// Allow to break the loop manually
|
126
|
-
if (this.stop) {
|
127
|
-
break;
|
128
|
-
}
|
129
|
-
const processed_data = await this._read_from_device_tcp();
|
130
|
-
if (!processed_data) {
|
131
|
-
continue;
|
132
|
-
}
|
133
|
-
if (processed_data.stable) {
|
134
|
-
this._stableMeasure();
|
135
|
-
} else {
|
136
|
-
this._unstableMeasure();
|
137
|
-
stream_success_counter = 20;
|
138
|
-
}
|
139
|
-
if (processed_data.stable && stream_success_counter <= 0) {
|
140
|
-
this._stableMeasure();
|
141
|
-
this._awaitingMeasure();
|
142
|
-
this._recordMeasure();
|
143
|
-
break;
|
144
|
-
} else if (this.remote_device_data.non_stop_read) {
|
145
|
-
stream_success_counter = 20;
|
146
|
-
this._recordMeasure();
|
147
|
-
}
|
148
|
-
if (stream_success_counter) {
|
149
|
-
--stream_success_counter;
|
150
|
-
}
|
151
|
-
icon = this._nextStateIcon(icon);
|
152
|
-
this.amount = processed_data.value;
|
153
|
-
this._setMeasure();
|
154
|
-
// Set sleep interval
|
155
|
-
if (this.remote_device_data.read_interval) {
|
156
|
-
await timer(this.remote_device_data.read_interval);
|
157
|
-
}
|
158
|
-
}
|
159
|
-
},
|
160
|
-
/**
|
161
|
-
* Convert the measured units to the units expecte by the record if different
|
162
|
-
* @param {Number} amount
|
163
|
-
* @returns {Number} converted amount
|
164
|
-
*/
|
165
|
-
_compute_quantity(amount) {
|
166
|
-
if (this.uom.id === this.device_uom.id) {
|
167
|
-
return amount;
|
168
|
-
}
|
169
|
-
let converted_amount = amount / this.remote_device_data.uom_factor;
|
170
|
-
converted_amount *= this.uom.factor;
|
171
|
-
return converted_amount;
|
172
|
-
},
|
173
|
-
/**
|
174
|
-
* Set value
|
175
|
-
*/
|
176
|
-
async _setMeasure() {
|
177
|
-
if (isNaN(this.amount)) {
|
178
|
-
return;
|
179
|
-
}
|
180
|
-
this.amount = this._compute_quantity(this.amount);
|
181
|
-
if (this.start_add) {
|
182
|
-
this.amount += this.input_val;
|
183
|
-
}
|
184
|
-
this.$input.val(this.amount.toLocaleString(this.locale_code));
|
185
|
-
this._setValue(this.$input.val());
|
186
|
-
},
|
187
|
-
/**
|
188
|
-
* Procure to close the socket whenever the widget stops being used
|
189
|
-
*/
|
190
|
-
_closeSocket() {
|
191
|
-
if (this.socket) {
|
192
|
-
this.socket.close();
|
193
|
-
}
|
194
|
-
},
|
195
|
-
/**
|
196
|
-
* Animate the measure steps for each measure received.
|
197
|
-
* @param {String} icon
|
198
|
-
* @returns {String} next icon
|
199
|
-
*/
|
200
|
-
_nextStateIcon(icon) {
|
201
|
-
const next_icon = nextState[icon];
|
202
|
-
this.$icon.removeClass(icon);
|
203
|
-
this.$icon.addClass(next_icon);
|
204
|
-
return next_icon;
|
205
|
-
},
|
206
|
-
/**
|
207
|
-
* While a measure is not stable the button will be red
|
208
|
-
*/
|
209
|
-
_unstableMeasure() {
|
210
|
-
this.$stop_measure.removeClass("btn-primary btn-success");
|
211
|
-
this.$stop_measure.addClass("btn-danger");
|
212
|
-
},
|
213
|
-
/**
|
214
|
-
* Once we consider the measure is stable render the button as green
|
215
|
-
*/
|
216
|
-
_stableMeasure() {
|
217
|
-
this.$stop_measure.removeClass("btn-primary btn-danger");
|
218
|
-
this.$stop_measure.addClass("btn-success");
|
219
|
-
},
|
220
|
-
/**
|
221
|
-
* While the widget isn't querying it will be purple as a signal that we can start
|
222
|
-
*/
|
223
|
-
_awaitingMeasure() {
|
224
|
-
this.$start_measure.removeClass("btn-success btn-danger");
|
225
|
-
this.$start_measure.addClass("btn-primary");
|
226
|
-
this.$stop_measure.addClass("d-none");
|
227
|
-
this.$start_measure.removeClass("d-none");
|
228
|
-
if (this.$start_measure_add) {
|
229
|
-
this.$start_measure_add.removeClass("d-none");
|
230
|
-
}
|
231
|
-
},
|
232
|
-
/**
|
233
|
-
*
|
234
|
-
*/
|
235
|
-
_recordMeasure() {
|
236
|
-
this.start_add = false;
|
237
|
-
this.input_val = this.amount;
|
238
|
-
this.start_add = false;
|
239
|
-
},
|
240
|
-
/**
|
241
|
-
* Request measure to remote device
|
242
|
-
*/
|
243
|
-
measure() {
|
244
|
-
this.stop = false;
|
245
|
-
if (!this.$start_measure) return;
|
246
|
-
this.$start_measure.addClass("d-none");
|
247
|
-
this.$stop_measure.removeClass("d-none");
|
248
|
-
this.$icon = this.$stop_measure.find("i");
|
249
|
-
this[`_connect_to_${this.connection_mode}`]();
|
250
|
-
},
|
251
|
-
/**
|
252
|
-
* Stop requesting measures from device
|
253
|
-
*/
|
254
|
-
measure_stop() {
|
255
|
-
this._closeSocket();
|
256
|
-
this.stop = true;
|
257
|
-
this._awaitingMeasure();
|
258
|
-
this._recordMeasure();
|
259
|
-
},
|
260
|
-
/**
|
261
|
-
* Start requesting measures from the remote device
|
262
|
-
* @param {MouseEvent} ev
|
263
|
-
*/
|
264
|
-
_onMeasure(ev) {
|
265
|
-
ev.preventDefault();
|
266
|
-
this.measure();
|
267
|
-
},
|
268
|
-
_onMeasureAdd(ev) {
|
269
|
-
ev.preventDefault();
|
270
|
-
this.start_add = true;
|
271
|
-
this.$start_measure.addClass("d-none");
|
272
|
-
this.$start_measure_add.addClass("d-none");
|
273
|
-
this.$stop_measure.removeClass("d-none");
|
274
|
-
this.$icon = this.$stop_measure.find("i");
|
275
|
-
this[`_connect_to_${this.connection_mode}`]();
|
276
|
-
},
|
277
|
-
/**
|
278
|
-
* Validate the requested measure
|
279
|
-
* @param {MouseEvent} ev
|
280
|
-
*/
|
281
|
-
_onValidateMeasure(ev) {
|
282
|
-
ev.preventDefault();
|
283
|
-
this.measure_stop();
|
284
|
-
},
|
285
|
-
/**
|
286
|
-
* Remote measure handle to start measuring
|
287
|
-
* @returns {jQueryElement}
|
288
|
-
*/
|
289
|
-
_addRemoteMeasureWidgetStart() {
|
290
|
-
return $(
|
291
|
-
`
|
292
|
-
<span class="o_field_remote_device_start btn btn-primary mr-1">
|
293
|
-
<i class="fa fa-thermometer-half">
|
294
|
-
</span>
|
295
|
-
`
|
296
|
-
).on("click", this._onMeasure.bind(this));
|
297
|
-
},
|
298
|
-
/**
|
299
|
-
* Remote measure handle to start measuring
|
300
|
-
* @returns {jQueryElement}
|
301
|
-
*/
|
302
|
-
_addRemoteMeasureWidgetStartAdd() {
|
303
|
-
return $(
|
304
|
-
`
|
305
|
-
<span class="o_field_remote_device_start btn btn-link mr-1">
|
306
|
-
<i class="fa fa-plus">
|
307
|
-
</span>
|
308
|
-
`
|
309
|
-
).on("click", this._onMeasureAdd.bind(this));
|
310
|
-
},
|
311
|
-
/**
|
312
|
-
* Remote measure handle to stop and register measuring
|
313
|
-
* @returns {jQueryElement}
|
314
|
-
*/
|
315
|
-
_addRemoteMeasureWidgetStop() {
|
316
|
-
return $(
|
317
|
-
`
|
318
|
-
<span class="o_field_remote_device_stop btn btn-secondary d-none mr-1">
|
319
|
-
<i class="fa fa-thermometer-empty">
|
320
|
-
</span>
|
321
|
-
`
|
322
|
-
).on("click", this._onValidateMeasure.bind(this));
|
323
|
-
},
|
324
|
-
};
|
325
|
-
|
326
|
-
export const RemoteMeasure = FieldFloat.extend(RemoteMeasureMixin, {
|
327
|
-
description: _lt("Remote Measure"),
|
328
|
-
className: "o_field_remote_device o_field_number",
|
329
|
-
tagName: "span",
|
330
|
-
isQuickEditable: true,
|
331
|
-
resetOnAnyFieldChange: true,
|
332
|
-
events: Object.assign({}, FieldFloat.prototype.events, {
|
333
|
-
focusin: "_onFocusIn",
|
334
|
-
}),
|
335
|
-
/**
|
336
|
-
* Setup the field layout and the remote device parameters
|
337
|
-
*/
|
338
|
-
init() {
|
339
|
-
this._super(...arguments);
|
340
|
-
if (this.mode === "edit") {
|
341
|
-
this.tagName = "div";
|
342
|
-
this.className += " o_input";
|
343
|
-
}
|
344
|
-
this.locale_code = _t.database.parameters.code.replace("_", "-");
|
345
|
-
this.decimal_separator = _t.database.parameters.decimal_point;
|
346
|
-
this.thousands_sep = _t.database.parameters.thousands_sep;
|
347
|
-
this.remote_device_field = this.nodeOptions.remote_device_field;
|
348
|
-
this.default_user_device = this.nodeOptions.default_user_device;
|
349
|
-
if (this.nodeOptions.remote_device_field === "id") {
|
350
|
-
this.remote_device_data = this.recordData;
|
351
|
-
} else if (this.remote_device_field) {
|
352
|
-
this.remote_device_data = this.recordData[this.remote_device_field].data;
|
353
|
-
}
|
354
|
-
this.uom = this.recordData[this.nodeOptions.uom_field].data;
|
355
|
-
this.allow_additive_measure = this.nodeOptions.allow_additive_measure;
|
356
|
-
// Add to your view options so you can log requests and responses
|
357
|
-
},
|
358
|
-
/**
|
359
|
-
* Request the configured remote device info
|
360
|
-
*/
|
361
|
-
async willStart() {
|
362
|
-
await this._super(...arguments);
|
363
|
-
// Try to get the user's preferred device if any
|
364
|
-
if (!this.remote_device_data && this.default_user_device) {
|
365
|
-
[this.remote_device_data] = await this._rpc({
|
366
|
-
model: "res.users",
|
367
|
-
method: "read",
|
368
|
-
args: [session.uid, ["remote_measure_device_id"]],
|
369
|
-
});
|
370
|
-
if (!this.remote_device_data.remote_measure_device_id) {
|
371
|
-
return;
|
372
|
-
}
|
373
|
-
if (this.remote_device_data) {
|
374
|
-
this.remote_device_data.id =
|
375
|
-
this.remote_device_data.remote_measure_device_id[0];
|
376
|
-
}
|
377
|
-
}
|
378
|
-
if (!this.remote_device_data || !this.uom) {
|
379
|
-
return;
|
380
|
-
}
|
381
|
-
[this.remote_device_data] = await this._rpc({
|
382
|
-
model: "remote.measure.device",
|
383
|
-
method: "read",
|
384
|
-
args: [this.remote_device_data.id, []],
|
385
|
-
});
|
386
|
-
[this.uom] = await this._rpc({
|
387
|
-
model: "uom.uom",
|
388
|
-
method: "read",
|
389
|
-
args: [this.uom.id, []],
|
390
|
-
});
|
391
|
-
this.uom_category = this.uom.category_id[0];
|
392
|
-
this.device_uom_category = this.remote_device_data.uom_category_id[0];
|
393
|
-
this.device_uom = this.remote_device_data.uom_id[0];
|
394
|
-
this.host = this.remote_device_data && this.remote_device_data.host;
|
395
|
-
this.protocol = this.remote_device_data && this.remote_device_data.protocol;
|
396
|
-
this.connection_mode =
|
397
|
-
this.remote_device_data && this.remote_device_data.connection_mode;
|
398
|
-
},
|
399
|
-
/**
|
400
|
-
* Set de widget layout up
|
401
|
-
* @returns {Promise}
|
402
|
-
*/
|
403
|
-
_renderEdit() {
|
404
|
-
this.$el.empty();
|
405
|
-
var def = this._prepareInput(this.$input).appendTo(this.$el);
|
406
|
-
// From locale format
|
407
|
-
if (this.input_val === undefined) {
|
408
|
-
let pre_value = this.$input.val() || "0";
|
409
|
-
pre_value = pre_value.replace(this.thousands_sep, "");
|
410
|
-
pre_value = pre_value.replace(this.decimal_separator, ".");
|
411
|
-
this.input_val = parseFloat(pre_value);
|
412
|
-
}
|
413
|
-
this.start_add = false;
|
414
|
-
const [device_uom = undefined] =
|
415
|
-
(this.remote_device_data && this.remote_device_data.uom_id) || [];
|
416
|
-
if (
|
417
|
-
!this.remote_device_data ||
|
418
|
-
!this.uom ||
|
419
|
-
!device_uom ||
|
420
|
-
this.uom_category !== this.device_uom_category
|
421
|
-
) {
|
422
|
-
return def;
|
423
|
-
}
|
424
|
-
this.$start_measure = this._addRemoteMeasureWidgetStart();
|
425
|
-
this.$stop_measure = this._addRemoteMeasureWidgetStop();
|
426
|
-
if (this.allow_additive_measure && this.input_val > 0) {
|
427
|
-
this.$start_measure_add = this._addRemoteMeasureWidgetStartAdd();
|
428
|
-
this.$el.prepend(this.$start_measure_add);
|
429
|
-
}
|
430
|
-
this.$el.prepend(this.$start_measure, this.$stop_measure);
|
431
|
-
return def;
|
432
|
-
},
|
433
|
-
/**
|
434
|
-
* Read right on if configured
|
435
|
-
* @override
|
436
|
-
*/
|
437
|
-
start() {
|
438
|
-
this._super(...arguments).then(() => {
|
439
|
-
if (this.remote_device_data && this.remote_device_data.instant_read) {
|
440
|
-
this.measure();
|
441
|
-
}
|
442
|
-
});
|
443
|
-
},
|
444
|
-
/**
|
445
|
-
* Ensure that the socket is allways closed
|
446
|
-
*/
|
447
|
-
destroy() {
|
448
|
-
this._closeSocket();
|
449
|
-
this._super.apply(this, arguments);
|
450
|
-
},
|
451
|
-
/**
|
452
|
-
* Auto select all the content
|
453
|
-
*/
|
454
|
-
_onFocusIn: function () {
|
455
|
-
// Auto select all content when user enters into fields with this
|
456
|
-
// widget.
|
457
|
-
this.$input.select();
|
458
|
-
},
|
459
|
-
});
|
460
|
-
|
461
|
-
fieldRegistry.add("remote_measure", RemoteMeasure);
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8" ?>
|
2
|
-
<template>
|
3
|
-
<t t-name="web_widget_remote_measure.measure_device_status">
|
4
|
-
<div class="float-right" name="is_up">
|
5
|
-
<span
|
6
|
-
t-attf-class="fa fa-circle {{widget.className}}"
|
7
|
-
role="img"
|
8
|
-
aria-label="Host is up?"
|
9
|
-
t-attf-title="{{widget.title}}"
|
10
|
-
name="is_up"
|
11
|
-
>
|
12
|
-
</span>
|
13
|
-
</div>
|
14
|
-
</t>
|
15
|
-
</template>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
odoo/addons/web_widget_remote_measure/README.rst,sha256=XkGL88YGhwbemju9-3F4UNsxfDQo109d4G2_3TFli5A,4962
|
2
|
-
odoo/addons/web_widget_remote_measure/__init__.py,sha256=jQ-fltIs1ohXt7udDkkJwzh7ckauQW2rbmv1Wtg3SjQ,47
|
3
|
-
odoo/addons/web_widget_remote_measure/__manifest__.py,sha256=w4x2WLp1ztqs3gOD62UyHB5BUVDfo8DUXakAJIOlINo,935
|
4
|
-
odoo/addons/web_widget_remote_measure/controllers/__init__.py,sha256=4KFqEP2QHFbPN66eQJMdGsmNz2v7ywWv_FR1pW_kkLk,19
|
5
|
-
odoo/addons/web_widget_remote_measure/controllers/main.py,sha256=Y7-KWYAzJUsFOUXp8pYb6gubSRPjYaMMTK-EwPvf-FM,1596
|
6
|
-
odoo/addons/web_widget_remote_measure/i18n/es.po,sha256=kRExBvXqKLl-OsldqqfXEvO3DsxlhVJsdUEzhTPXwm8,11634
|
7
|
-
odoo/addons/web_widget_remote_measure/i18n/web_widget_remote_measure.pot,sha256=KxGwpx8coIWOz2BxEXZZ3C4wVg2BJJdUDQJVkFbLEAs,10054
|
8
|
-
odoo/addons/web_widget_remote_measure/models/__init__.py,sha256=J_ouBD3wdPWoRA5-ZLkwygexPIblJEq2FymqQkO9ez8,60
|
9
|
-
odoo/addons/web_widget_remote_measure/models/remote_measure_device.py,sha256=btbPQiNQ8Su7pKEOVzMt8hmMWaZDvRJepvijSv9FH3c,2695
|
10
|
-
odoo/addons/web_widget_remote_measure/models/res_users.py,sha256=EBbwk30Jzd_lFSsUT3ciwfP_lFWlD8kD9uZYVXrTvnk,485
|
11
|
-
odoo/addons/web_widget_remote_measure/readme/CONFIGURE.rst,sha256=4ZndrZNCFSSTNyNiRbvVUGXBRyUxEHfld7hlmq66iXc,377
|
12
|
-
odoo/addons/web_widget_remote_measure/readme/CONTRIBUTORS.rst,sha256=CsagrKWiP3dFqMxkMX1CjG1YBQmJt5Bc4CtU1UoRK9Q,95
|
13
|
-
odoo/addons/web_widget_remote_measure/readme/DESCRIPTION.rst,sha256=0ZoY5qczzhDfXvpyx5OUOBLsQFHA_dRIwu8qSFeUu1c,241
|
14
|
-
odoo/addons/web_widget_remote_measure/readme/ROADMAP.rst,sha256=Z0aICtUk3GUOPY5NVUo4TRyWbtmVHRfzJZrVvFzvBb8,251
|
15
|
-
odoo/addons/web_widget_remote_measure/readme/USAGE.rst,sha256=z2p53R2-gi5mY3lTvXmFlslFIItzvrERwqkui7tWdjg,845
|
16
|
-
odoo/addons/web_widget_remote_measure/security/ir.model.access.csv,sha256=3bwXFcGN-56-3-aR-RYGH8G6sVnuYkirAzpY4dDu8IA,426
|
17
|
-
odoo/addons/web_widget_remote_measure/security/security.xml,sha256=1lW2jowKe0fu9fRj-dPZt0-2q70c4VQKxBBHSAzE7L0,264
|
18
|
-
odoo/addons/web_widget_remote_measure/static/description/icon.png,sha256=O9NGHv3egMV4Z7wp_y1yxXS9BmUi7AiGAleQTwMkuRo,9652
|
19
|
-
odoo/addons/web_widget_remote_measure/static/description/index.html,sha256=1ijKHvVxb-9jm3mef3nm1GE7QTP36hUR3vybeh-izL4,15497
|
20
|
-
odoo/addons/web_widget_remote_measure/static/src/js/remote_measure_device_kanban_widget.esm.js,sha256=vw2rHAKmv8F7V3AKVydkN01yNW4_b_uhO0O-GgUWlzI,1119
|
21
|
-
odoo/addons/web_widget_remote_measure/static/src/js/remote_measure_widget.esm.js,sha256=btbxBKiu65prtRhMw6Mqh3jMBnKoY70RAwzltaqqBXw,15431
|
22
|
-
odoo/addons/web_widget_remote_measure/static/src/js/systray_device_selector.esm.js,sha256=GeAoxLPc8u6Kgx7kdb34fWa3il5uyxFnroD5q5hfRi4,1372
|
23
|
-
odoo/addons/web_widget_remote_measure/static/src/scss/remote_measure_widget.scss,sha256=khdgvWe-uCaz6mXOTrO3-3sMhU8AJkCNA-8-EqaHhqM,643
|
24
|
-
odoo/addons/web_widget_remote_measure/static/src/xml/measure_device_status.xml,sha256=ZiDIjjUC_6OmMCt5CuZjivQQ5GbXw9k63eNlYmCez7E,461
|
25
|
-
odoo/addons/web_widget_remote_measure/static/src/xml/systray_device_selector.xml,sha256=LZIlsnhgzCDFnZRtTZc2okAPQC4qoxoe0Khi1oDzU_c,692
|
26
|
-
odoo/addons/web_widget_remote_measure/views/remote_measure_device_views.xml,sha256=pyIEp4WqR9hmfA5fXtsNYb78f5VFpiGVG7fBZxwjkjU,4630
|
27
|
-
odoo/addons/web_widget_remote_measure/views/res_users_views.xml,sha256=QqvjaLWw1eEWJc8nShScpi-OcPeg7QV8OoqVnEOgJWY,2315
|
28
|
-
odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info/METADATA,sha256=pSxFLCBuZkcS4qlyLgPa-rZ5XtnyBOHJSF5-VmWEF-I,5518
|
29
|
-
odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
30
|
-
odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
31
|
-
odoo_addon_web_widget_remote_measure-15.0.1.1.0.2.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
odoo
|
File without changes
|