Author: |
GRAP, Odoo Community Association (OCA) |
License: |
AGPL-3 |
Branch: |
10.0 |
Repository: |
anhvu-sg/stock-logistics-barcode |
Dependencies: |
barcodes,
product,
and
web |
Languages: |
HTML (408, 41.3%),
JavaScript (16, 1.6%),
PO File (160, 16.2%),
Python (214, 21.6%),
XML (76, 7.7%),
and
reStructuredText (115, 11.6%) |
Other repositories: |
ForgeFlow/stock-logistics-barcode,
LevelPrime/stock-logistics-barcode,
OCA/stock-logistics-barcode,
QubiQ/stock-logistics-barcode,
grap/stock-logistics-barcode,
and
wader1990/stock-logistics-barcode |
<h1 class="title">Search By Barcode</h1>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/tree/10.0/barcodes_search"><img alt="OCA/stock-logistics-barcode" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--barcode-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-barcode-10-0/stock-logistics-barcode-10-0-barcodes_search"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/150/10.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module expends Odoo functionality, allowing user to search any item by
its barcode.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#development" id="id2">Development</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<a name="usage"></a>
<h2><a class="toc-backref" href="#id1">Usage</a></h2>
<ul class="simple">
<li>In the main menu click on the barcode new button</li>
</ul>
<img alt="New icon in Odoo Top Menu" src="https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/barcode_button_menu.png" />
<ul class="simple">
<li>In the pop up form, enter the barcode and click on the search button</li>
</ul>
<img alt="Partner Search Form" src="https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/partner_search.png" style="width: 800px;" />
<p><strong>Case 1: One item found</strong></p>
<p>If an item is found, the pop up is closed, and the form view of the item is
displayed. (Demo data with <code>0419100000009</code> to search a partner)</p>
<p><strong>Case 2: Many items found</strong></p>
<p>If many items are found, the list of the items are displayed and the user
can go on the according form view by clicking on the button on the end of
the line. This case can occur:</p>
<ul class="simple">
<li>in a normal case, if a barcode is associated to many models. Two typical
cases are : product.product / product.template and res.users / res.partner.
(Demo data with <code>3057068106783</code> to search a product)</li>
<li>if the database is corrupted, and a barcode is set to many differents
items.</li>
</ul>
<img alt="Partner and User Result form" src="https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/partner_user_search.png" style="width: 800px;" />
<p><strong>Case 3: Barcode with specific rule</strong></p>
<p>In some specifics cases when the barcode contains extra data (like price
or weight), the barcode will be different than the product barcode.
In that case, the item is displayed, and the data is analysed.</p>
<p>Exemple : Barcode <code>2391000005002</code> when:</p>
<ul class="simple">
<li><code>23</code> is a prefix</li>
<li><code>91000</code> is a base code of the product</li>
<li><code>00500</code> is the price</li>
<li><code>2</code> is a control digit</li>
</ul>
<p>If this barcode is entered, the product with the barcode <code>2391000000007</code> will
be returned.</p>
<img alt="Price Product Search Form" src="https://raw.githubusercontent.com/OCA/stock-logistics-barcode/10.0/barcodes_search/static/description/price_product_search.png" style="width: 800px;" />
<a name="development"></a>
<h2><a class="toc-backref" href="#id2">Development</a></h2>
<p><strong>Use in other modules</strong></p>
<p>The search will be done on all the fields named <code>barcode</code> in any models.</p>
<p>For developers, there are one handy method in <code>barcode.search</code> as well:</p>
<pre>
<code lang="python">result = self.env['barcode.search'].search_by_barcode('12345567890123')</code>
</pre>
<pre>
<code lang="python">@api.model
def search_by_barcode(self, barcode):
"""Return the record associated with the barcode.
Args:
barcode (str): Barcode string to search for.
Returns: a tuple (Field, BaseModel, ExtraData)
Field: a record of the field that matched the search
BaseModel: A record matching the barcode, if existing
ExtraData: An optional dictionnary that provides extra informations
"""</code>
</pre>
<p><strong>Inheritance</strong></p>
<ul class="simple">
<li>If you want to make a search on a field that is not named 'barcode', you
should overload the function <code>get_barcode_fields</code> of the model
<code>barcode.search</code>.</li>
<li>If you want to implement another integration of extra data in a barcode
via a rule, you should overload the function
<code>get_model_by_rule_type</code> of the model <code>barcode.search</code>.</li>
</ul>
<p>For the time being, three rule types are handled:</p>
<ul class="simple">
<li><code>weight</code>, defined in Odoo <code>stock</code> module</li>
<li><code>price</code>, defined in Odoo <code>point_of_sale</code> module</li>
<li><code>price_to_weight</code>, defined in OCA <code>pos_price_to weight</code> module</li>
</ul>
<a name="bug-tracker"></a>
<h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20barcodes_search%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
<a name="credits"></a>
<h2><a class="toc-backref" href="#id4">Credits</a></h2>
<a name="authors"></a>
<h3><a class="toc-backref" href="#id5">Authors</a></h3>
<ul class="simple">
<li>GRAP</li>
</ul>
<a name="contributors"></a>
<h3><a class="toc-backref" href="#id6">Contributors</a></h3>
<ul class="simple">
<li>Sylvain LE GAL <<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>></li>
</ul>
<a name="maintainers"></a>
<h3><a class="toc-backref" href="#id7">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/tree/10.0/barcodes_search">OCA/stock-logistics-barcode</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>