Skip to content
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
11 changes: 6 additions & 5 deletions pos_product_multi_barcode/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================
PoS Product multi barcode
=========================
Expand All @@ -17,7 +13,7 @@ PoS Product multi barcode
.. |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/license-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
Expand All @@ -37,6 +33,10 @@ This module allows to use multiple barcode on a product from the PoS
See
https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_multi_barcode

Barcode scanning is first resolved using the POS client-side indexed
products. If not found, it falls back to a backend search via
``pos.session.find_product_by_barcode``.

**Table of contents**

.. contents::
Expand Down Expand Up @@ -66,6 +66,7 @@ Contributors
- Pierrick Brun <pierrick.brun@akretion.com>
- Ilyas <irazor147@gmail.com>
- Nguyen Minh Chien <chien@trobz.com>
- Patryk Pyczko <patryk.pyczko@nagarro.com>

Other credits
-------------
Expand Down
1 change: 1 addition & 0 deletions pos_product_multi_barcode/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import product
from . import pos_session
32 changes: 32 additions & 0 deletions pos_product_multi_barcode/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def find_product_by_barcode(self, barcode, config_id):
result = super().find_product_by_barcode(barcode, config_id)

if result.get("product.product"):
return result

product = self.env["product.product"].search(
[
("barcode_ids.name", "=", barcode),
("sale_ok", "=", True),
("available_in_pos", "=", True),
],
limit=1,
)

if not product:
return result

product_fields = self.env["product.product"]._load_pos_data_fields(config_id)
product_context = {**self.env.context, "display_default_code": False}

return {
"product.product": product.with_context(**product_context).read(
product_fields, load=False
)
}
1 change: 1 addition & 0 deletions pos_product_multi_barcode/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
> - Pierrick Brun \<pierrick.brun@akretion.com\>
> - Ilyas \<irazor147@gmail.com\>
> - Nguyen Minh Chien \<chien@trobz.com\>
> - Patryk Pyczko \<patryk.pyczko@nagarro.com\>
2 changes: 2 additions & 0 deletions pos_product_multi_barcode/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ This module allows to use multiple barcode on a product from the PoS

See
<https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_multi_barcode>

Barcode scanning is first resolved using the POS client-side indexed products. If not found, it falls back to a backend search via `pos.session.find_product_by_barcode`.
30 changes: 14 additions & 16 deletions pos_product_multi_barcode/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>PoS Product multi barcode</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,24 +360,22 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="pos-product-multi-barcode">
<h1 class="title">PoS Product multi barcode</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="pos-product-multi-barcode">
<h1>PoS Product multi barcode</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9f76bd9121937cb6f997cf5b53fde50357291796f7e9d9daf7d2b05cd8a99add
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/18.0/pos_product_multi_barcode"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_product_multi_barcode"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/pos/tree/18.0/pos_product_multi_barcode"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_product_multi_barcode"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to use multiple barcode on a product from the PoS</p>
<p>See
<a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_multi_barcode">https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_multi_barcode</a></p>
<p>Barcode scanning is first resolved using the POS client-side indexed
products. If not found, it falls back to a backend search via
<tt class="docutils literal">pos.session.find_product_by_barcode</tt>.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -392,38 +390,39 @@ <h1>PoS Product multi barcode</h1>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_product_multi_barcode%0Aversion:%2018.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>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<blockquote>
<ul class="simple">
<li>Pierrick Brun &lt;<a class="reference external" href="mailto:pierrick.brun&#64;akretion.com">pierrick.brun&#64;akretion.com</a>&gt;</li>
<li>Ilyas &lt;<a class="reference external" href="mailto:irazor147&#64;gmail.com">irazor147&#64;gmail.com</a>&gt;</li>
<li>Nguyen Minh Chien &lt;<a class="reference external" href="mailto:chien&#64;trobz.com">chien&#64;trobz.com</a>&gt;</li>
<li>Patryk Pyczko &lt;<a class="reference external" href="mailto:patryk.pyczko&#64;nagarro.com">patryk.pyczko&#64;nagarro.com</a>&gt;</li>
</ul>
</blockquote>
</div>
<div class="section" id="other-credits">
<h3><a class="toc-backref" href="#toc-entry-5">Other credits</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<p>The migration of this module from 14.0 to 16.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<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" />
Expand All @@ -436,6 +435,5 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Loading