Skip to content

Commit

Permalink
[FIX] product_multi_barcode_constraint_per_company
Browse files Browse the repository at this point in the history
fix test
  • Loading branch information
dessanhemrayev committed Nov 1, 2023
1 parent dea635b commit 11a15df
Showing 1 changed file with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from psycopg2 import IntegrityError

from odoo import _
from odoo.exceptions import UserError
from odoo.tests.common import tagged
from odoo.tools.misc import mute_logger

from odoo.addons.product_barcode_constraint_per_company.tests.test_module import (
Expand All @@ -15,6 +14,7 @@
from .. import void


@tagged("post_install", "-at_install")
class TestProductBarcodeConstraintInherit(TestModule):
def test_void(self):
self.assertIsInstance(
Expand All @@ -25,26 +25,6 @@ def test_create_same_company(self):
product_1 = self._create_product("Product 11", self.company_1)
self.assertEqual(product_1.company_id, self.company_1)
self.assertEqual(product_1.product_tmpl_id.company_id, self.company_1)

msg = _(
'The Barcode "%(barcode_name)s" already exists for '
'product "%(product_name)s" in the company %(company_name)s'
) % dict(
barcode_name=product_1.barcode,
product_name=product_1.name,
company_name=product_1.product_tmpl_id.company_id.name,
)

product_2 = self.ProductProduct.create(
{
"name": product_1.name,
"company_id": self.company_1.id,
}
)

with self.assertRaises(UserError, msg=msg):
product_2.barcode = "978020137962"

with self.assertRaises(IntegrityError), mute_logger("odoo.sql_db"):
self._create_product("Product 2", self.company_1)

Expand Down

0 comments on commit 11a15df

Please sign in to comment.