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

[MIG][13.0] stock_barcodes_gs1: Migration to v13.0 #254

Merged
merged 12 commits into from
Jul 26, 2020
1 change: 1 addition & 0 deletions setup/stock_barcodes_gs1/odoo/addons/stock_barcodes_gs1
6 changes: 6 additions & 0 deletions setup/stock_barcodes_gs1/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
10 changes: 5 additions & 5 deletions stock_barcodes_gs1/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Stock Barcodes GS1
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--barcode-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-barcode/tree/12.0/stock_barcodes_gs1
:target: https://github.com/OCA/stock-logistics-barcode/tree/13.0/stock_barcodes_gs1
:alt: OCA/stock-logistics-barcode
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-barcode-12-0/stock-logistics-barcode-12-0-stock_barcodes_gs1
:target: https://translation.odoo-community.org/projects/stock-logistics-barcode-13-0/stock-logistics-barcode-13-0-stock_barcodes_gs1
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/150/12.0
:target: https://runbot.odoo-community.org/runbot/150/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -45,7 +45,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-barcode/issues>`_.
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 <https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20stock_barcodes_gs1%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20stock_barcodes_gs1%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -80,6 +80,6 @@ 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.

This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/12.0/stock_barcodes_gs1>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/13.0/stock_barcodes_gs1>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion stock_barcodes_gs1/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Stock Barcodes GS1",
"summary": "It provides read GS1 barcode on stock operations.",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://odoo-community.org/",
"license": "AGPL-3",
Expand Down
6 changes: 3 additions & 3 deletions stock_barcodes_gs1/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Stock Barcodes GS1</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/12.0/stock_barcodes_gs1"><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-12-0/stock-logistics-barcode-12-0-stock_barcodes_gs1"><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/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<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/13.0/stock_barcodes_gs1"><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-13-0/stock-logistics-barcode-13-0-stock_barcodes_gs1"><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/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends barcode reader interface to allow to read GS1 barcodes.</p>
<p>The AI’s implemented are 01(Group), 02(Product), 37(Quantity) and 10(Lots).</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -392,7 +392,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<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:%20stock_barcodes_gs1%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/issues/new?body=module:%20stock_barcodes_gs1%0Aversion:%2013.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">
Expand Down Expand Up @@ -421,7 +421,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<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/12.0/stock_barcodes_gs1">OCA/stock-logistics-barcode</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-barcode/tree/13.0/stock_barcodes_gs1">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>
</div>
</div>
Expand Down
15 changes: 11 additions & 4 deletions stock_barcodes_gs1/tests/test_stock_barcodes_gs1.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Copyright 2108-2019 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import common

from odoo.addons.stock_barcodes.tests.test_stock_barcodes import TestStockBarcodes


@common.tagged("post_install", "-at_install")
class TestStockBarcodesGS1(TestStockBarcodes):
def setUp(self):
super().setUp()
Expand All @@ -19,10 +22,10 @@ def setUp(self):
"01993167101234533101002620130" "5041710ABC123214145354"
)

self.product_wo_tracking_gs1 = self.product_wo_tracking.copy(
self.product_wo_tracking_gs1 = self.product_wo_tracking.with_context({}).copy(
pedrobaeza marked this conversation as resolved.
Show resolved Hide resolved
{"barcode": "07010001234567"}
)
self.product_tracking_gs1 = self.product_tracking.copy()
self.product_tracking_gs1 = self.product_tracking.with_context({}).copy()
self.packaging_gs1 = self.ProductPackaging.create(
{
"product_id": self.product_wo_tracking_gs1.id,
Expand All @@ -43,7 +46,7 @@ def test_wizard_scan_gs1_package(self):
"(Barcode for product packaging not found)",
)
# Scan packaging barcode with more than one package
self.packaging_gs1.copy({"barcode": "19501101530000"})
self.packaging_gs1.with_context({}).copy({"barcode": "19501101530000"})
self.action_barcode_scanned(self.wiz_scan, self.gs1_barcode_01)
self.assertEqual(
self.wiz_scan.message,
Expand All @@ -65,7 +68,11 @@ def test_wizard_scan_gs1_product(self):
def test_wizard_scan_gs1_lot(self):
self.packaging_gs1.product_id = self.product_tracking_gs1
lot = self.StockProductionLot.create(
{"name": "AB-123", "product_id": self.product_tracking_gs1.id}
{
"name": "AB-123",
"product_id": self.product_tracking_gs1.id,
"company_id": self.company.id,
}
)
self.action_barcode_scanned(self.wiz_scan, self.gs1_barcode_01)
self.assertEqual(self.wiz_scan.lot_id, lot)
Expand Down
3 changes: 3 additions & 0 deletions stock_barcodes_gs1/tests/test_stock_barcodes_new_lot_gs1.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Copyright 2108-2019 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common

from odoo.addons.stock_barcodes_gs1.tests.test_stock_barcodes_gs1 import (
TestStockBarcodesGS1,
)


@common.tagged("post_install", "-at_install")
class TestStockBarcodesNewLotGS1(TestStockBarcodesGS1):
def setUp(self):
super().setUp()
Expand Down
6 changes: 5 additions & 1 deletion stock_barcodes_gs1/wizard/stock_barcodes_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ class WizStockBarcodesRead(models.AbstractModel):

def _prepare_lot_values(self, barcode_decoded):
lot_barcode = barcode_decoded.get("10", False)
return {"name": lot_barcode, "product_id": self.product_id.id}
return {
"name": lot_barcode,
"product_id": self.product_id.id,
"company_id": self.env.user.company_id.id,
}

def _create_lot(self, barcode_decoded):
return self.env["stock.production.lot"].create(
Expand Down