Author: |
GRAP, LasLabs, Odoo Community Association (OCA) |
License: |
AGPL-3 |
Branch: |
11.0-mig-ADD_barcodes_search |
Repository: |
ForgeFlow/stock-logistics-barcode |
Dependencies: |
barcodes,
product,
and
web |
Languages: |
JavaScript (16, 3.7%),
PO File (81, 18.5%),
Python (195, 44.6%),
XML (78, 17.8%),
and
reStructuredText (67, 15.3%) |
Other repositories: |
LevelPrime/stock-logistics-barcode,
OCA/stock-logistics-barcode,
QubiQ/stock-logistics-barcode,
anhvu-sg/stock-logistics-barcode,
grap/stock-logistics-barcode,
and
wader1990/stock-logistics-barcode |
<a class="reference external image-reference" href="https://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg">
</a>
<a name="search-by-barcode"></a>
<h2>Search by Barcode</h2>
<p>This module expends Odoo functionality, allowing user to search any item by
it barcode.</p>
<a name="usage"></a>
<h3>Usage</h3>
<ul class="simple">
<li>In the main menu click on the barcode new button</li>
</ul>
<img alt="/barcodes_search/static/description/barcode_button_menu.png" src="/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="/barcodes_search/static/description/partner_search.png" src="/barcodes_search/static/description/partner_search.png" style="width: 800px;" />
<p>1. If an item is found, the pop up is closed, and the form view of the item is
displayed.</p>
<p>2. 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 2391000005002 when:</p>
<ul class="simple">
<li>23 is a prefix</li>
<li>91000 is a base code of the product</li>
<li>00500 is the price</li>
<li>2 is a control digit</li>
</ul>
<p>If this barcode is entered, the product with the barcode 2391000000007 will
be returned.</p>
<img alt="/barcodes_search/static/description/price_product_search.png" src="/barcodes_search/static/description/price_product_search.png" style="width: 800px;" />
<ol class="arabic simple" start="3">
<li>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:</li>
</ol>
<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.</li>
<li>if the database is corrupted, and a barcode is set to many differents
items.</li>
</ul>
<img alt="/barcodes_search/static/description/partner_user_search.png" src="/barcodes_search/static/description/partner_user_search.png" style="width: 800px;" />
<a name="technical-note"></a>
<h4>Technical Note</h4>
<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>
<a name="try-on-runbot"></a>
<h4>Try On Runbot</h4>
<a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/150/11.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a>
<a name="inheritance"></a>
<h3>Inheritance</h3>
<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>
<h3>Bug Tracker</h3>
<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 feedback.</p>
<a name="credits"></a>
<h3>Credits</h3>
<a name="images"></a>
<h4>Images</h4>
<a name="contributors"></a>
<h4>Contributors</h4>
<ul class="simple">
<li>Sylvain LE GAL (<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>)</li>
<li>Dave Lasley <<a class="reference external" href="mailto:dave@laslabs.com">dave@laslabs.com</a>></li>
</ul>
<a name="maintainer"></a>
<h4>Maintainer</h4>
<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>This module is maintained by the OCA.</p>
<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>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>