Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12.0 pos qr scan barcode3 #1178

Open
wants to merge 5 commits into
base: 12.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions pos_clientlist_scan_button/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3

============================
Pos Clientlist Scan Button
============================

Adds scan button for some fields on clientlist screen

Adds scan button for some fields on clientlist screen

Credits
=======

Contributors
------------
* `Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>`__:

* :one::zero: init version of the module

Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__

Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/12.0/pos_clientlist_scan_button/>`__.

Thank you for understanding!

`IT-Projects Team <https://www.it-projects.info/team>`__

Further information
===================

Demo: http://runbot.it-projects.info/demo/pos-addons/12.0

HTML Description: https://apps.odoo.com/apps/modules/12.0/pos_clientlist_scan_button/

Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Notifications on updates: `via Atom <https://github.com/it-projects-llc/pos-addons/commits/12.0/pos_clientlist_scan_button.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/pos-addons/commits/12.0/pos_clientlist_scan_button.atom>`_

Tested on Odoo 12.0 3d0f8d07a494997be96868dd609bf4cc2ccc750c
Empty file.
51 changes: 51 additions & 0 deletions pos_clientlist_scan_button/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

{
"name": """pos_clientlist_scan_button""",
"summary": """Adds scan button for some fields on clientlist screen""",
"category": "Point of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/DEMO-URL?version=12.0",
"images": [],
"version": "12.0.1.0.0",
"application": False,

"author": "IT-Projects LLC, Kolushov Alexandr",
"support": "[email protected]",
"website": "https://apps.odoo.com/apps/modules/12.0/pos_clientlist_scan_button/",
"license": "LGPL-3",
# "price": 9.00,
# "currency": "EUR",

"depends": [
'pos_qr_scan',
],
"external_dependencies": {"python": [], "bin": []},
"data": [
'views/assets.xml',
],
"demo": [
],
"qweb": [
'static/src/xml/clientlist.xml',
],

"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"uninstall_hook": None,

"auto_install": False,
"installable": True,

# "demo_title": "pos_clientlist_scan_button",
# "demo_addons": [
# ],
# "demo_addons_hidden": [
# ],
# "demo_url": "DEMO-URL",
# "demo_summary": "Adds scan button for some fields on clientlist screen",
# "demo_images": [
# "images/MAIN_IMAGE",
# ]
}
4 changes: 4 additions & 0 deletions pos_clientlist_scan_button/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
`1.0.0`
-------

- **Init version**
trojikman marked this conversation as resolved.
Show resolved Hide resolved
35 changes: 35 additions & 0 deletions pos_clientlist_scan_button/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
============================
Pos Clientlist Scan Button
============================

Installation
============
{Instruction about things to do before actual installation}

* {OPTIONAL }`Activate longpolling <https://odoo-development.readthedocs.io/en/latest/admin/longpolling.html>`__
* {Additional notes if any}
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way

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

{Instruction how to configure the module before start to use it}

* `Log in as SUPERUSER <https://odoo-development.readthedocs.io/en/latest/odoo/usage/login-as-superuser.html>`__
* `Activate Developer Mode <https://odoo-development.readthedocs.io/en/latest/odoo/usage/debug-mode.html>`__
* Open menu ``[[ {Menu} ]] >> {Submenu} >> {Subsubmenu}``
* Click ``[{Button Name}]``

Usage
=====

{Instruction for daily usage. It should describe how to check that module works. What shall user do and what would user get.}

* Open menu ``[[ {Menu} ]]>> {Submenu} >> {Subsubmenu}``
* Click ``[{Button Name}]``
* RESULT: {what user gets, how the modules changes default behaviour}

Uninstallation
==============

{Optional section for uninstallation notes. Delete it if you don't have notes for uninstallation.}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions pos_clientlist_scan_button/static/src/js/pos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('pos_clientlist_scan_button.pos', function (require) {
"use strict";

var screens = require('point_of_sale.screens');

screens.ClientListScreenWidget.include({

display_client_details: function(visibility, partner, clickpos){
var self = this;
this._super(visibility, partner, clickpos);
var $buttons = this.$el.find('.button.scan').off();
if(visibility === 'edit'){
$buttons.on('click', function(ev) {
var field = this.attributes.data.value;
self.gui.show_popup('qr_scan', {
read_callback: self.scan_callback,
field: field,
ClientListScreenWidget: self
});
});
}
},

scan_callback: function(value, method) {
if (this.pos.debug){
console.log(method.toUpperCase() + ' scanned', value);
}
var $input = this.options.ClientListScreenWidget.$el.find('input.' + this.options.field);
if ($input) {
$input.val(value);
}
this.click_cancel();
},
});

});
16 changes: 16 additions & 0 deletions pos_clientlist_scan_button/static/src/xml/clientlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -->
<templates>

<t t-extend="ClientDetailsEdit">
<t t-jquery="input.detail.barcode" t-operation="after">
<span class='button scan barcode' data="barcode"><i class='fa fa-qrcode' role="img" aria-label="Scan" title="Scan"/></span>
</t>

<t t-jquery="input.detail.vat" t-operation="after">
<span class='button scan' data="vat"><i class='fa fa-qrcode' role="img" aria-label="Scan" title="Scan"/></span>
</t>
</t>

</templates>
11 changes: 11 additions & 0 deletions pos_clientlist_scan_button/views/assets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -->
<odoo>

<template id="pos" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_clientlist_scan_button/static/src/js/pos.js"></script>
</xpath>
</template>

</odoo>
24 changes: 18 additions & 6 deletions pos_qr_scan/README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
=========================
QR Code Scanning in POS
POS QR/Barcode Scanning
=========================

Scans QR codes via device's camera.
Scans QR codes and barcodes via device's camera.

the module supports next barcode codings:

* code 128
* ean
* ean 8
* code 39
* code 39 vin
* codabar
* upc
* upc e
* i2of5
* code 93

Usage
=====

To subscribe to scanning event use following code in js::
To subscribe to qr scanning event use following code in js::

var core = require('web.core');
core.bus.on('qr_scanned', this, function(value){
// your handler here
})

});

Credits
=======
Expand Down Expand Up @@ -41,4 +53,4 @@ Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Tested on Odoo 11.0 c7171795f891335e8a8b6d5a6b796c28cea77fea
Tested on Odoo 12.0 53dcdd5a9e22429a9638f68674264436ce21e42b
3 changes: 3 additions & 0 deletions pos_qr_scan/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import models
6 changes: 5 additions & 1 deletion pos_qr_scan/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": """QR Code Scanning in POS""",
"summary": """Scans QR codes via device's camera""",
"category": "Point of Sale",
# "live_test_url": "",
"images": ["images/main.png"],
"version": "12.0.1.0.1",
"version": "12.0.2.0.0",
"application": False,

"author": "IT-Projects LLC, KolushovAlexandr",
Expand All @@ -20,6 +23,7 @@
"external_dependencies": {"python": [], "bin": []},
"data": [
"views/assets.xml",
'views/pos_config.xml',
],
"qweb": [
"static/src/xml/templates.xml",
Expand Down
10 changes: 10 additions & 0 deletions pos_qr_scan/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
`2.0.0`
-------

- **Improvement:** - Barcode scanner added

`1.0.2`
-------

- **Fix:** - Scanner didn't work due to "ReferenceError: gCtx is not defined"

trojikman marked this conversation as resolved.
Show resolved Hide resolved
`1.0.1`
-------

Expand Down
6 changes: 4 additions & 2 deletions pos_qr_scan/doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=========================
QR Code Scanning in POS
POS QR/Barcode Scanning
=========================

Installation
Expand All @@ -10,7 +10,9 @@ Installation
Configuration
=============

Browser can get access to camera only on using via ``https`` connection.
Browser may not give access to camera if using insecure ``http`` connection.

Reference: https://www.w3.org/TR/secure-contexts/#threat-risks

Possible NGINX configurations to support ``https``::

Expand Down
3 changes: 3 additions & 0 deletions pos_qr_scan/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)

from . import pos_config
21 changes: 21 additions & 0 deletions pos_qr_scan/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models


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

use_only_qr_scan = fields.Boolean('Only QR scanning')
use_only_barcode_scan = fields.Boolean('Only Barcode scanning')

@api.onchange('use_only_qr_scan')
def _onchange_use_only_qr_scan(self):
if self.use_only_qr_scan:
self.use_only_barcode_scan = False

@api.onchange('use_only_barcode_scan')
def _onchange_use_only_barcode_scan(self):
if self.use_only_barcode_scan:
self.use_only_qr_scan = False
1 change: 1 addition & 0 deletions pos_qr_scan/static/lib/Quagga/quagga.min.js

Large diffs are not rendered by default.

Loading