Skip to content

Commit

Permalink
[ADD] web_widget_remote_measure: New module
Browse files Browse the repository at this point in the history
TT38745
  • Loading branch information
chienandalu committed May 16, 2023
1 parent b98bb58 commit a527c20
Show file tree
Hide file tree
Showing 22 changed files with 1,159 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/web_widget_remote_measure/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
130 changes: 130 additions & 0 deletions web_widget_remote_measure/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
============================
Remote Measure Devices Input
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/15.0/web_widget_remote_measure
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_widget_remote_measure
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to input data from remote devices in your network. Currently, only
websockets devices are supported, but it can be extended for any protocol like
Webservices.

Other modules can extend this one in order to use the widget.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure your remote devices:

#. Go to *Settings > Technical > Devices > Remote devices*
#. Create a new one configuring the required info.
#. If the devices has an special port, set it up in the host data: e.g.: 10.1.1.2:3210

Usage
=====

The remote device has to be in the users network so their web clients can reach them.

In order to test a device you can:

#. Go to *Settings > Technical > Devices > Remote devices*
#. In the Kanban view you'll wich devices can be reached as they'll have a green dot in
their card.
#. Go to one of those and click *Edit*.
#. You can start measuring from the remote device in the *Test measure* field.

On the technical side, you can use the widget in your own `Float``. You'll need to
provide an uom field so records that aren't in that UoM don't measure from the device.

.. code:: xml
<field name="float_field" widget="remote_measure" options="{'remote_device_field': 'measure_device_id', 'uom_field': 'uom_id'}" />
Known issues / Roadmap
======================

Current support:

- Websockets connection
- F501 protocol on continuous message stream.

But this is a commonground to add:

- Other connection interfaces like Webservices APIs
- Other device protocols.
- Active device controls, la Tare, resets, etc.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_widget_remote_measure%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* David Vidal

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-chienandalu| image:: https://github.com/chienandalu.png?size=40px
:target: https://github.com/chienandalu
:alt: chienandalu

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-chienandalu|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_widget_remote_measure>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions web_widget_remote_measure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions web_widget_remote_measure/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Remote Measure Devices Input",
"summary": "Allows to connect to remote devices to record measures",
"version": "15.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"maintainers": ["chienandalu"],
"license": "AGPL-3",
"category": "Stock",
"depends": ["web", "uom"],
"data": [
"views/remote_measure_device_views.xml",
"views/res_users_views.xml",
"security/ir.model.access.csv",
],
"assets": {
"web.assets_backend": [
"web_widget_remote_measure/static/src/**/*.js",
"web_widget_remote_measure/static/src/**/*.scss",
],
"web.assets_qweb": ["web_widget_remote_measure/static/src/**/*.xml"],
},
}
2 changes: 2 additions & 0 deletions web_widget_remote_measure/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import remote_measure_device
from . import res_users
30 changes: 30 additions & 0 deletions web_widget_remote_measure/models/remote_measure_device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models


class RemoteMeasureDevice(models.Model):
_name = "remote.measure.device"
_description = "Remote measure device"

active = fields.Boolean(default=True)
name = fields.Char(required=True)
uom_id = fields.Many2one(
string="Unit of measure",
comodel_name="uom.uom",
required=True,
)
protocol = fields.Selection(
selection=[("f501", "Scale F501")],
help="Operating protocol",
required=True,
)
connection_mode = fields.Selection(
selection=[
("websockets", "Web Sockets"),
("webservices", "Web Services"),
],
required=True,
)
host = fields.Char(required=True)
test_measure = fields.Float(default=0.0)
12 changes: 12 additions & 0 deletions web_widget_remote_measure/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models


class ResUsers(models.Model):
_inherit = "res.users"

remote_measure_device_id = fields.Many2one(
comodel_name="remote.measure.device",
help="Default remote measure device for this user",
)
5 changes: 5 additions & 0 deletions web_widget_remote_measure/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To configure your remote devices:

#. Go to *Settings > Technical > Devices > Remote devices*
#. Create a new one configuring the required info.
#. If the devices has an special port, set it up in the host data: e.g.: 10.1.1.2:3210
3 changes: 3 additions & 0 deletions web_widget_remote_measure/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* David Vidal
5 changes: 5 additions & 0 deletions web_widget_remote_measure/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module allows to input data from remote devices in your network. Currently, only
websockets devices are supported, but it can be extended for any protocol like
Webservices.

Other modules can extend this one in order to use the widget.
10 changes: 10 additions & 0 deletions web_widget_remote_measure/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Current support:

- Websockets connection
- F501 protocol on continuous message stream.

But this is a commonground to add:

- Other connection interfaces like Webservices APIs
- Other device protocols.
- Active device controls, la Tare, resets, etc.
16 changes: 16 additions & 0 deletions web_widget_remote_measure/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The remote device has to be in the users network so their web clients can reach them.

In order to test a device you can:

#. Go to *Settings > Technical > Devices > Remote devices*
#. In the Kanban view you'll wich devices can be reached as they'll have a green dot in
their card.
#. Go to one of those and click *Edit*.
#. You can start measuring from the remote device in the *Test measure* field.

On the technical side, you can use the widget in your own `Float``. You'll need to
provide an uom field so records that aren't in that UoM don't measure from the device.

.. code:: xml
<field name="float_field" widget="remote_measure" options="{'remote_device_field': 'measure_device_id', 'uom_field': 'uom_id'}" />
3 changes: 3 additions & 0 deletions web_widget_remote_measure/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
web_widget_remote_measure.access_remote_measure_device_user,access_remote_measure_device users,web_widget_remote_measure.model_remote_measure_device,base.group_user,1,0,0,0
web_widget_remote_measure.access_remote_measure_device_admin,access_remote_measure_device admin,web_widget_remote_measure.model_remote_measure_device,base.group_system,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a527c20

Please sign in to comment.