Skip to content

Commit

Permalink
Merge PR #240 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Jan 8, 2020
2 parents 1ccc3ac + f215f56 commit 88b08c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
7 changes: 0 additions & 7 deletions product_multi_ean/i18n/product_multi_ean.pot
Expand Up @@ -87,10 +87,3 @@ msgstr ""
#, python-format
msgid "The EAN13 Barcode \"%s\" already exists for product \"%s\""
msgstr ""

#. module: product_multi_ean
#: code:addons/product_multi_ean/models/product_product.py:39
#, python-format
msgid "You provided an invalid \"EAN13 Barcode\" reference. You may use the \"Internal Reference\" field instead."
msgstr ""

12 changes: 0 additions & 12 deletions product_multi_ean/models/product_product.py
Expand Up @@ -28,18 +28,6 @@ class ProductEan13(models.Model):
required=True,
)

@api.multi
@api.constrains('name')
@api.onchange('name')
def _check_name(self):
barcode_obj = self.env['barcode.nomenclature']
for record in self.filtered('name'):
if not barcode_obj.check_ean(record.name):
raise UserError(
_('You provided an invalid "EAN13 Barcode" reference. '
'You may use the "Internal Reference" '
'field instead.'))

@api.multi
@api.constrains('name')
def _check_duplicates(self):
Expand Down
8 changes: 3 additions & 5 deletions product_multi_ean/tests/test_product_multi_ean.py
Expand Up @@ -2,10 +2,12 @@
# © 2018 Xavier Jimenez (QubiQ)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase
from odoo.tests.common import TransactionCase, at_install, post_install
from ..hooks import post_init_hook


@at_install(False)
@post_install(True)
class TestProductMultiEan(TransactionCase):
def setUp(self):
super(TestProductMultiEan, self).setUp()
Expand All @@ -29,10 +31,6 @@ def test_set_main_ean(self):
self.assertEqual(self.product_1.ean13_ids.name, self.product_1.barcode)

def test_set_incorrect_ean(self):
with self.assertRaises(Exception):
self.product_1.barcode = '1234567890123'
with self.assertRaises(Exception):
self.product_1.ean13_ids = [(0, 0, {'name': '1234567890123'})]
self.product_1.barcode = self.valid_ean_1
# Insert duplicated EAN13
with self.assertRaises(Exception):
Expand Down

0 comments on commit 88b08c8

Please sign in to comment.