Search 1.9 billion lines of Odoo code on GitHub

barcodes

Author:
License: no license
Branch: transactions
Repository: aakzubaidi/ODEX
Dependencies: web
Languages: JavaScript (1205, 8.0%), PO File (13476, 89.2%), Python (201, 1.3%), XML (115, 0.8%), and reStructuredText (105, 0.7%)
Other branches: accounting, hr, master, and odexbase
Other repositories: Aaronpan126/odoo13-x64, Aidako20/flectra, Aidako20/flectra-1, Albin-John/flectra, Aldais/odoo, AwesomeFoodCoops/odoo-production, CarlosPichardo/flectra, DITIntl/odoo-production, DITIntl/odoo10-x64, ERPymes/ERPymes, Elbagoury/actpy, Elbagoury/pos, Elico-Corp/odoo, Groupe-Informatique-LaCoopSurMer/odoo-production, JBAhire/flectra, MAbuElmagd/odoo-1, MadhbhavikaR/actpy, Maxwc/flectra, Moh-has/ODEX, NIKULAHIR/flectra, OCA/OCB, OCA/OpenUpgrade, Otsokop/odoo-production, Regent-Young/odoo12-x64, Saran440/Odoo, SaravananSakthivel/flectra-1, SetRac/pos-1, SistemERP/flectra, Storegud/flectra, TamerNagah/odoo13-x64, ThanhICSC/skit_odoo12, XtremXpert/flectra, XtremXpert/flectra-1, Zilur/odoo13-x64, achuthanselvaraj/pos, actpy/actpy, aden-lu/odoo13-x64, afgnsu/odoo12-x64, alangwansui/Enterprise_odoo_account, alangwansui/odoo10-x64, alangwansui/odoo12-x64, alhashash/flectra, amco/odoo, anndream/flectra, anuprakash/flectra, arakdraja/flectra, armohamm/actpy, askmetoo/actpy, azmeuk/odoo-production, babatoko/odoo-production, baidule/odoo10-x64, baimnimax/flectra, baomi4577/odoo12-x64, baomi4577/odoo13-x64, beloeuvre/odoo-production, borderitsolutions/flectra, boujie06/actpy, bunheng168/odoo, caosena5101/odoo11-x64, carito1982m/odoo, chenzhiming/odoo10-x64, chenzhiming/odoo11-x64, chenzhiming/odoo12-x64, chetanrdhaduk/odoo-production, chianggq/odoo11-x64, chinanet001/odoo10-x64, chinanet001/odoo12-x64, chinu23081994/odoo, choilive/odoo, cialuo/flectra, claro5/odoo10-x64, claro5/odoo11-x64, claro5/odoo12-x64, demain-supermarche/odoo-production, diode/flectra, druidoo/FoodCoops, dzungtran89/odoo-production, ehabqino/odoo13-x64, elhartimohamedcharif/actpy, eribowo/skit_odoo12, ericdai/flectra, eslammohamed13/actpy, eslammohamed13/pos, estevebadia/odoo-production, ewail/odoo_win10, expsa/ODEX, ezdoo/flectra, ezdoo/flectra01, ferdiga/flectra, fjouatte/odoo-production, flectra-hq/flectra, fourthgear88/flectra, fwl998877/odoo12-x64, gastonfeng/odoo11-x64, genral73/ODEX, grap/pos, guohuadeng/odoo10-x64, guohuadeng/odoo11-x64, guohuadeng/odoo12-x64, guohuadeng/odoo13-x64, gustotc/odoo11-x64, gustotc/odoo12-x64, hakimtawerghi/odoo-1, halgandd/odoo-production, hamedalhosiny/actpy, hamzawy55/actpy, hanasaram/odoo, hawkeg/ODEX, hilarak/odoo-production, hljhttp/odoo11-x64, hxq123-qing/odoo13-x64, hzh0292/odoo12-x64, iSqXIE/odoo12-x64, inftao/odoo12-x64, inftao/odoo13-x64, ironhuan/odoo12-x64, isos/flectra-1, isoscl/flectra, istevenG/flectra-1, izzihector/pos, jackxusho/odoo10-x64, jackxusho/odoo12-x64, jackxusho/odoo13-x64, jason156/odoo10-x64, jason156/odoo11-x64, jason156/odoo12-x64, javogiraldez/skit_odoo12, jenggo/flectra, jlzhou/flectra, jlzhou/odoo10-x64, josealfredomunozmelendez/flectra, jsrhtc/odoo13-x64, jupiterzhuo/skit_odoo12, jweste/odoo-production, kenoyer/odoo, kevinpthorne/flectra, kit9/skit_odoo12, krunal267/odoo-production, lachouettecoop/odoo-production, leao-c/flectra, legalsylvain/odoo-production, lelsheri/flectra, limengchang/odoo13-x64, limweb/flectra01, lisidan/odoo12-x64, lo-gun/flectra-1, luchaoshuai/flectra, lukehuang/odoo12-x64, ly2ly/flectra, mah007/actpy, manishmarahatta/flectra, marionumza/pos-1, marionumza/skit_odoo12, mathieuvatel/odoo-production, mausvt/flectra, mszinte/odoo-production, muguli22/flectra, muhassaf/flectra, muk-projects/flectra, mulaudzicalvin/odoo-production, ncavalierm/flectra, netice/flectra, nileshsheliya/odoo, niulinlnc/flectra, niulinlnc/odoo12-x64, niulinlnc/odoo13-x64, niulinlnc/skit_odoo12, ntcat/odoo12-x64, nthnnl/odoo-production, ntiufalara/universidade-digital, odoo-modules/odoo-production, odoo/odoo, okkype/flectra, old-boy/odoo12-x64, omegayang/odoo11-x64, onmywaytoheaven/odoo, owenwdx/odoo12-x64, owenwdx/odoo13-x64, petrus-v/odoo-foodcoops, phuctranerp/odoo-production, pinghendro/flectra, rapidgrps/eagle-erp-main, realestdon/odoo, redhead520/odoo12-x64, ricky6251/ssh-git-github.com-odoo-odoo.git-13.0-ricky6251, rihene-abdelwahed/odoo-production, robinNode/flectra, royallinejo/odoo13-x64, s2motion/flectra, samuel1971/odoo11-x64, sasakuma/odoo12-x64, sayeedul-islam-bd/flectra, sc4you/odoo-production, sematicshood/flectra, senthilnathang/flectra, siddharth7815/odoo-production, simhaonline/flectra, simplifysolutions/flectra, slacrey/odoo13-x64, sm2x/skit_odoo12, softapps/odoo12, soksireyrath/odoo, sprevot44/odoo-production, srikesh/skit_odoo12, suningwz/odoo-production, supercoopbdx/odoo-production, superquinquin/odoo-production, tejastank/flectra-1, thapelombulase/flectra, thomasullrich/odoo, tonyshen277/odoo12-x64, tonyshen277/odoo13-x64, trobz/odoo-production, ttpphuctran/odoo-production, umingpeng/odoo, usp-sa/actpy, vak0160/odoo-1, valdir-ti/flectra, valenciaricardos/flectra, valenciaricardos/flectra-1, varcharli/odoo13-x64, vidtsin/odoo-production, vidtsin/pos, vieterp-huy/odoo, vincentchen/odoo11-x64, wdjlover/odoo11-x64, westlyou/flectra-1, westlyou/odoo10-x64, westlyou/odoo13-x64, wuhuizhong/flectra, wwjiang007/flectra-1, wwwebweber/flectra, xiaonibakeji/odoo12-x64, xuliang87/odoo11-x64, yasr3mr96/actpy, yf956613/odoo12-x64, yf956613/odoo13-x64, yuntux/odoo-production, yvescharles/flectra, z042492/odoo10-x64, zeinfikri/flectra, zeroincombenze/account-closing, zeroincombenze/account-financial-reporting, zeroincombenze/account-financial-tools, zeroincombenze/account-invoicing, zeroincombenze/account-payment, zeroincombenze/bank-payment, zeroincombenze/crm, zeroincombenze/knowledge, zeroincombenze/management-system, zeroincombenze/partner-contact, zeroincombenze/product-attribute, zeroincombenze/report-print-send, zeroincombenze/stock-logistics-barcode, zeroincombenze/stock-logistics-tracking, zeroincombenze/stock-logistics-warehouse, zeroincombenze/stock-logistics-workflow, zeroincombenze/web, zfis/skit_odoo12, zhaohuaw/odoo12-x64, zhb123/actpy, and zyfking/odoo12-x64

<h1 class="title">Barcodes module documentation</h1> <p>This module brings barcode encoding logic and client-side barcode scanning utilities.</p> <a name="barcodes-encoding"></a> <h2>Barcodes encoding</h2> <p>The Barcodes module defines barcode nomenclatures whose rules identify specific type of items e.g. products, locations. It contains the following features:</p> <ul class="simple"> <li>Patterns to identify barcodes containing a numerical value (e.g. weight, price)</li> <li>Definitin of barcode aliases that allow to identify the same product with different barcodes</li> <li>Unlimited barcode patterns and definitions,</li> <li>Support for encodings EAN-13, EAN-8 and UPC-A</li> </ul> <a name="barcode-encodings"></a> <h3>Barcode encodings</h3> <p>A barcode is an arbitrary long sequence of ASCII characters. An EAN-13 barcode is a 13 digit barcode, whose 13th digit is the checksum.</p> <a name="simple-barcodes-and-rules"></a> <h3>Simple barcodes and rules</h3> <p>The default nomenclature assumes an EAN-13 encoding for product barcodes. It defines a rule for Unit Products whose encoding is EAN-13, and whose pattern is '.', i.e. any barcode matches this pattern. Scanning the barcode of a product, say '5410013101703', matches this rule. The scanned item is thus identified as a Unit Product, and is retrieved from the product table.</p> <p>Note: the special character '.' in patterns is matched by any character. To explicitely specify the '.' character in a pattern, escape it with ''. The '' character has to be escaped as well ('\') to be explicitely specified.</p> <p>Let us now suppose that we identify other items with barcodes, say stock locations. We define a new rule in the nomenclature with the corresponding type (in our example, the type is 'Location'), and whose pattern is e.g. '414.', that is, any location barcode starts with '414'. Scanning a barcode location, say '41401', matches this Location rule, and the corresponding location is retrieved from the location table.</p> <p>Note: Rules have a sequence field which indicates the order the rules are evaluated (ASC). In our previous examples, the Unit Product rule should have a larger sequence that then Location rule, because we want the latter one to be evaluated first.</p> <a name="barcodes-with-numerical-content"></a> <h3>Barcodes with numerical content</h3> <p>Barcodes may encode numerical content, which is decoded by the barcodes module. To that purpose, one have to define a new rule for barcodes with numerical content (e.g. barcodes for Weighted Products). The numerical content in a pattern is specified between braces (special characters '{' and '}'). The content of the braces must be a sequence of 'N's (representing the whole part of the numerical content) followed by a sequence of 'D's (representing the decimal part of the numerical content). For instance, let us define a new rule for Weighted Products whose pattern is '21.....{NNDDD}.'. Since we assume EAN-13 encoding for product barcodes, the encoding of this rule should be EAN-13 as well.</p> <p>Let us now assume that we want to write a barcode for a given Weighted Product, say oranges. We first have to define in product oranges a barcode that will match the Weighted Product rule. This barcode must start with '21' and be a correct EAN-13 barcode (i.e. the 13th digit must be a correct checksum). Moreover, all the numerical content must be set to a '0'. For instance, let us set the barcode to '2100001000004'.</p> <p>We now want to write a barcode for 2.75kg of oranges. This barcode should be '2100001027506' (the numerical content of this barcode is '02750', and the correct checksum is '6'). When scanned, this barcode matches the Weighted Product rule (since is starts with '21'). The numerical content is extracted, and replaced by a sequence of '0's. The correct checksum is then computed for the obtained barcode ('2100001000004') and the corresponding product (oranges) is retrieved from product table.</p> <p>Note: the special characters '{' and '}' in patterns are used to identify numerical content. To explicitely specify '{' or '}' in a pattern, they must be escaped.</p> <a name="strict-ean-13-field-of-barcode-nomenclatures"></a> <h3>Strict EAN-13 field of barcode nomenclatures</h3> <p>Many barcode scanners strip the leading zero when scanning EAN-13 barcodes. Barcode nomenclatures have a boolean field &quot;Use strict EAN13&quot;. If False, when trying to match a scanned barcode with a rule whose encoding is EAN-13, if the barcode is of length 12 and, by prepending it by a 0, the last digit is the correct checksum, we automatically prepend the barcode by 0 and try to find a match with this new barcode. If &quot;Use strict EAN13&quot; is set to True, we look for a pattern matching the original, 12-digit long, barcode.</p> <a name="barcodes-scanning"></a> <h2>Barcodes scanning</h2> <a name="scanning"></a> <h3>Scanning</h3> <p>Use a USB scanner (that mimics keyboard inputs) in order to work with barcodes in Odoo. The scanner must be configured to use no prefix and a carriage return or tab as suffix. The delay between each character input must be less than or equal to 50 milliseconds. Most barcode scanners will work out of the box. However, make sure the scanner uses the same keyboard layout as the device it's plugged in. Either by setting the device's keyboard layout to US QWERTY (default value for most readers) or by changing the scanner's keyboard layout (check the manual).</p> <a name="barcode-events"></a> <h3>Barcode events</h3> <p>When the module barcodes is installed, it instanciate a singleton of the javascript class BarcodeEvents. The purpose of this component is to listen to keypresses to detect barcodes, then dispatch those barcodes on core.bus inside a 'barcode_event'. All keypress events are buffered until there is no more keypress during 50ms or a carriage return / tab is inputted (because most barcode scanners use this as a suffix). If the buffered keys looks like a barcode, an event is triggered : core.bus.trigger('barcode_scanned', barcode); Otherwise, the keypresses are 'resent'. However, for security reasons, a keypress event programmatically crafted doesn't trigger native browser behaviors. For this reason, BarcodeEvents doesn't intercept keypresses whose target is an editable element (eg. input) or when ctrl/cmd/alt is pushed. To catch keypresses targetting an editable element, it must have the attribute barcode_events=&quot;true&quot;.</p> <a name="barcode-handlers"></a> <h3>Barcode handlers</h3> <p>To keep the web client consistent, components that want to listen to barcode events should include BarcodeHandlerMixin. It requires method on_barcode_scanned(barcode) to be implemented and exposes methods start_listening and stop_listening As long as it is the descendant of a View managed by a ViewManager is only listens while the view is attached.</p> <a name="form-view-barcode-handler"></a> <h3>Form view barcode handler</h3> <p>It is possible for a form view to listen to barcode events, handle them client side and/or server-side. When the barcode is handled server-side, it works like an onchange. The relevant model must include the BarcodeEventsMixin and redefine method on_barcode_scanned. This method receives the barcode scanned and the <cite>self</cite> is a pseudo-record representing the content of the form view, just like in &#64;api.onchange methods. Barcodes prefixed with 'O-CMD' or 'O-BTN' are reserved for special features and are never passed to on_barcode_scanned. The form view barcode handler can be extended to add client-side handling. Please refer to the (hopefully well enough) documented file for more informations.</p> <a name="button-barcode-handler"></a> <h3>Button barcode handler</h3> <p>Add an attribute 'barcode_trigger' to a button to be able to trigger it by scanning a barcode. Example : &lt;button name=&quot;validate&quot; type=&quot;object&quot; barcode_trigger=&quot;validate&quot;/&gt; will be triggered when a barcode containing &quot;O-BTN.validate&quot; is scanned.</p>