Andrea
6 years ago
committed by
tarteo
11 changed files with 139 additions and 28 deletions
-
68partner_coc/README.rst
-
2partner_coc/__init__.py
-
11partner_coc/__manifest__.py
-
2partner_coc/models/__init__.py
-
5partner_coc/models/res_partner.py
-
2partner_coc/readme/CONTRIBUTORS.rst
-
1partner_coc/readme/DESCRIPTION.rst
-
4partner_coc/readme/USAGE.rst
-
3partner_coc/tests/__init__.py
-
64partner_coc/tests/test_partner_coc.py
-
5partner_coc/views/res_partner_view.xml
@ -1 +1,3 @@ |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import models |
@ -1 +1,3 @@ |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import res_partner |
@ -0,0 +1,2 @@ |
|||
* Dennis Sluijk <d.sluijk@onestein.nl> |
|||
* Andrea Stirpe <a.stirpe@onestein.nl> |
@ -0,0 +1 @@ |
|||
This module adds the field *Chamber Of Commerce Registration Number* to partners. |
@ -0,0 +1,4 @@ |
|||
To use this module, you need to: |
|||
|
|||
#. Go to the partner form; |
|||
#. make sure the partner is a company. |
@ -0,0 +1,3 @@ |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import test_partner_coc |
@ -0,0 +1,64 @@ |
|||
# Copyright 2018 Onestein (<http://www.onestein.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
|
|||
|
|||
class TestPartnerCoC(TransactionCase): |
|||
def setUp(self): |
|||
super(TestPartnerCoC, self).setUp() |
|||
self.main_partner = self.env.ref('base.main_partner') |
|||
self.partner_id_category = self.env.ref('partner_coc.id_category_coc') |
|||
|
|||
def test_01_id_number_new(self): |
|||
# Good CoC |
|||
vals = { |
|||
'name': '56048785', |
|||
'category_id': self.partner_id_category.id, |
|||
} |
|||
self.main_partner.write({'id_numbers': [(0, 0, vals)]}) |
|||
id_number = self.main_partner.id_numbers[0] |
|||
|
|||
self.assertEqual(id_number.name, '56048785') |
|||
|
|||
def test_02_id_number_duplicate(self): |
|||
# Duplicate CoC |
|||
vals = { |
|||
'name': '56048785', |
|||
'category_id': self.partner_id_category.id, |
|||
} |
|||
|
|||
self.main_partner.write({'id_numbers': [(0, 0, vals)]}) |
|||
id_number_name = self.main_partner.id_numbers[0].name |
|||
self.assertEqual(id_number_name, '56048785') |
|||
|
|||
new_partner = self.env['res.partner'].create({'name': 'Test Partner'}) |
|||
|
|||
new_partner.write({'id_numbers': [(0, 0, vals)]}) |
|||
id_number_name = new_partner.id_numbers[0].name |
|||
self.assertEqual(id_number_name, '56048785') |
|||
|
|||
def test_03_coc_registration_number_create(self): |
|||
new_partner = self.env['res.partner'].create({ |
|||
'name': 'Test Partner', |
|||
'coc_registration_number': '56048785', |
|||
}) |
|||
|
|||
self.assertEqual(new_partner.coc_registration_number, '56048785') |
|||
|
|||
id_numbers = new_partner.id_numbers |
|||
self.assertTrue(id_numbers) |
|||
self.assertEqual(len(id_numbers), 1) |
|||
self.assertEqual(id_numbers.name, '56048785') |
|||
|
|||
def test_04_coc_registration_number_write(self): |
|||
self.main_partner.write({ |
|||
'coc_registration_number': '56048785' |
|||
}) |
|||
coc = self.main_partner.coc_registration_number |
|||
self.assertEqual(coc, '56048785') |
|||
|
|||
id_numbers = self.main_partner.id_numbers |
|||
self.assertTrue(id_numbers) |
|||
self.assertEqual(len(id_numbers), 1) |
|||
self.assertEqual(id_numbers.name, '56048785') |
Write
Preview
Loading…
Cancel
Save
Reference in new issue