-
-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] test file and resolved travis issues
- Loading branch information
Showing
8 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2004 Tiny SPRL | ||
# © 2016 Sodexis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
def pre_init_hook(cr): | ||
""" | ||
Updates existing codes matching the default '/' or | ||
empty. Primarily this ensures installation does not | ||
fail for demo data. | ||
:param cr: database cursor | ||
:return: void | ||
""" | ||
cr.execute("UPDATE product_product " | ||
"SET default_code = '!!mig!!' || id " | ||
"WHERE default_code IS NULL OR default_code = '/';") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Sodexis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import test_product_sequence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Sodexis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp.tests.common import TransactionCase | ||
|
||
|
||
class TestProductSequence(TransactionCase): | ||
"""Tests for creating product with and without Product Sequence""" | ||
|
||
def setUp(self): | ||
super(TestProductSequence, self).setUp() | ||
self.product_product = self.env['product.product'] | ||
|
||
def test_product_create_with_default_code(self): | ||
product_id = self.product_product.create(dict( | ||
name="Apple", | ||
default_code='PROD01' | ||
)) | ||
self.assertEqual(product_id.default_code, 'PROD01') | ||
|
||
def test_product_create_without_default_code(self): | ||
product_id_1 = self.product_product.create(dict(name="Orange")) | ||
self.assertRegexpMatches(str(product_id_1.default_code), r'PR/*') |