Skip to content

Commit

Permalink
[ADD] pos_rfid: мигрированная версия приватного модуля
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Yelizariev <[email protected]>
Co-authored-by: Alexandr Kolusov <[email protected]>
Co-authored-by: Artem Rafailov <[email protected]>
Co-authored-by: Eugene Molotov <[email protected]>
  • Loading branch information
5 people committed Nov 2, 2024
1 parent 70d739b commit b6166ee
Show file tree
Hide file tree
Showing 19 changed files with 689 additions and 0 deletions.
92 changes: 92 additions & 0 deletions pos_rfid/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
======================
RFID adapter for POSes
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:82e8f0faf8fa78126dea845163c89a69a84ceb534bd749e3b299888bcfcfa196
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-it--projects--llc%2Fpos--addons-lightgray.png?logo=github
:target: https://github.com/it-projects-llc/pos-addons/tree/17.0/pos_rfid
:alt: it-projects-llc/pos-addons

|badge1| |badge2| |badge3|

Converts RFID scan result to a proper value.

It's not possible to make similar module that depends on ``barcodes``
only, because in some cases there is no way to automatically detect
shall code be translated or not. So in that cases we trigger several
events: with original code and with translated ones.

Adapters
========

HEX to DEC
----------

E.g. ``9cc29d808 >> 042080000008``

**Table of contents**

.. contents::
:local:

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

- Open "Point of Sale" app
- Open "Configutration" -> "Settings"
- Choose POS
- Enable "HEX Barcode" option

Usage
=====

- Open POS
- Scan RFID
- RESULT: POS reacts in the same way as if RFID was scanned via normal
RFID reader

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

Bugs are tracked on `GitHub Issues <https://github.com/it-projects-llc/pos-addons/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/it-projects-llc/pos-addons/issues/new?body=module:%20pos_rfid%0Aversion:%2017.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
-------

* IT-Projects LLC

Contributors
------------

- Ivan Yelizariev (https://github.com/yelizariev)
- Alexandr Kolusov (https://github.com/KolushovAlexandr)
- Artem Rafailov (https://github.com/Ommo73)
- Eugene Molotov (https://github.com/em230418)

Maintainers
-----------

This module is part of the `it-projects-llc/pos-addons <https://github.com/it-projects-llc/pos-addons/tree/17.0/pos_rfid>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions pos_rfid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import controllers
24 changes: 24 additions & 0 deletions pos_rfid/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": """RFID adapter for POSes""",
"summary": """Converts RFID scan result to a proper value""",
"category": "Point of Sale",
"version": "17.0.0.9.0",
"author": "IT-Projects LLC",
"support": "[email protected]",
"website": "https://github.com/it-projects-llc/pos-addons",
"license": "LGPL-3",
"depends": [
"point_of_sale",
],
"assets": {
"point_of_sale._assets_pos": [
"pos_rfid/static/src/**/*",
],
},
"data": [
"views/res_config_settings_views.xml",
],
"demo": [
"data/point_of_sale_demo.xml",
],
}
1 change: 1 addition & 0 deletions pos_rfid/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
15 changes: 15 additions & 0 deletions pos_rfid/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo.http import request, route

from odoo.addons.point_of_sale.controllers.main import PosController


class PosControllerRFID(PosController):
@route()
def pos_web(self, config_id=False, **kw):
res = super().pos_web(config_id, **kw)
if not config_id:
return res

config = request.env["pos.config"].sudo().browse(int(config_id))
res.qcontext["session_info"]["pos_hex_barcode"] = config.hex_barcode
return res
37 changes: 37 additions & 0 deletions pos_rfid/data/point_of_sale_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- These values are copied from point_of_sale's demo -->
<!-- we remove one zero in middle of barcode values in order for test data to work -->

<record id='base.res_partner_1' model='res.partner'>
<field name='barcode'>042010000005</field>
</record>

<record id='base.res_partner_2' model='res.partner'>
<field name='barcode'>042020000004</field>
</record>

<record id='base.res_partner_3' model='res.partner'>
<field name='barcode'>042030000003</field>
</record>

<record id='base.res_partner_4' model='res.partner'>
<field name='barcode'>042070000009</field>
</record>

<record id='base.res_partner_10' model='res.partner'>
<field name='barcode'>042100000003</field>
</record>

<record id='base.res_partner_12' model='res.partner'>
<field name='barcode'>042080000008</field>
</record>

<record id='base.res_partner_18' model='res.partner'>
<field name='barcode'>042180000005</field>
</record>

<record id="base.user_root" model="res.users">
<field name="barcode">041010000006</field>
</record>
</odoo>
2 changes: 2 additions & 0 deletions pos_rfid/migrations/17.0.1.0.0/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def migrate(cr, installed_version):
cr.execute("UPDATE pos_config SET hex_barcode = pos_rfid")
2 changes: 2 additions & 0 deletions pos_rfid/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import pos_config
from . import res_config_settings
8 changes: 8 additions & 0 deletions pos_rfid/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

hex_barcode = fields.Boolean("HEX Barcode")
pos_rfid = fields.Boolean(deprecated=True)
10 changes: 10 additions & 0 deletions pos_rfid/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_hex_barcode = fields.Boolean(
related="pos_config_id.hex_barcode",
readonly=False,
)
3 changes: 3 additions & 0 deletions pos_rfid/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions pos_rfid/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Open "Point of Sale" app
- Open "Configutration" -> "Settings"
- Choose POS
- Enable "HEX Barcode" option
4 changes: 4 additions & 0 deletions pos_rfid/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Ivan Yelizariev (https://github.com/yelizariev)
- Alexandr Kolusov (https://github.com/KolushovAlexandr)
- Artem Rafailov (https://github.com/Ommo73)
- Eugene Molotov (https://github.com/em230418)
12 changes: 12 additions & 0 deletions pos_rfid/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Converts RFID scan result to a proper value.

It's not possible to make similar module that depends on `barcodes` only, because in some cases there is no way to automatically detect shall code be translated or not.
So in that cases we trigger several events: with original code and with translated ones.

Adapters
========

HEX to DEC
----------

E.g. `9cc29d808 >> 042080000008`
3 changes: 3 additions & 0 deletions pos_rfid/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Open POS
* Scan RFID
* RESULT: POS reacts in the same way as if RFID was scanned via normal RFID reader
Binary file added pos_rfid/static/description/icon.png
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 b6166ee

Please sign in to comment.