diff --git a/partner_coc/README.rst b/partner_coc/README.rst index b9864716f..29726443d 100644 --- a/partner_coc/README.rst +++ b/partner_coc/README.rst @@ -1,12 +1,36 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - =========== Partner CoC =========== -Adds a field 'Chamber Of Commerce Registration Number' to partner. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/11.0/partner_coc + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-11-0/partner-contact-11-0-partner_coc + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the field *Chamber Of Commerce Registration Number* to partners. + +**Table of contents** + +.. contents:: + :local: Usage ===== @@ -16,37 +40,43 @@ To use this module, you need to: #. Go to the partner form; #. make sure the partner is a company. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/10.0 - Bug Tracker =========== -Bugs are tracked on `GitHub 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. +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Onestein + Contributors ------------- +~~~~~~~~~~~~ * Dennis Sluijk +* Andrea Stirpe -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. \ No newline at end of file +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_coc/__init__.py b/partner_coc/__init__.py index 0650744f6..31660d6a9 100644 --- a/partner_coc/__init__.py +++ b/partner_coc/__init__.py @@ -1 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from . import models diff --git a/partner_coc/__manifest__.py b/partner_coc/__manifest__.py index 3659fe811..1c03f84b8 100644 --- a/partner_coc/__manifest__.py +++ b/partner_coc/__manifest__.py @@ -1,11 +1,13 @@ +# Copyright 2017-2018 Onestein () +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + { 'name': 'Partner CoC', - 'summary': "Adds a field 'Chamber Of Commerce Registration Number' to " - "partner", - 'version': '10.0.1.0.0', + 'summary': "Adds field 'Chamber Of Commerce Registration Number'", + 'version': '11.0.1.0.0', 'category': 'Web', 'author': 'Onestein,Odoo Community Association (OCA)', - 'website': 'http://www.onestein.eu', + 'website': 'https://github.com/OCA/partner-contact/', 'license': 'AGPL-3', 'depends': [ 'partner_identification', @@ -15,5 +17,4 @@ 'views/res_partner_view.xml' ], 'installable': True, - 'application': False, } diff --git a/partner_coc/models/__init__.py b/partner_coc/models/__init__.py index 91fed54d4..c6cc3b329 100644 --- a/partner_coc/models/__init__.py +++ b/partner_coc/models/__init__.py @@ -1 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from . import res_partner diff --git a/partner_coc/models/res_partner.py b/partner_coc/models/res_partner.py index ad283c56f..b09d3a591 100644 --- a/partner_coc/models/res_partner.py +++ b/partner_coc/models/res_partner.py @@ -1,4 +1,7 @@ -from odoo import models, fields +# Copyright 2017-2018 Onestein () +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models class ResPartner(models.Model): diff --git a/partner_coc/readme/CONTRIBUTORS.rst b/partner_coc/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..8bbaf9867 --- /dev/null +++ b/partner_coc/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Dennis Sluijk +* Andrea Stirpe diff --git a/partner_coc/readme/DESCRIPTION.rst b/partner_coc/readme/DESCRIPTION.rst new file mode 100644 index 000000000..3870069fe --- /dev/null +++ b/partner_coc/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds the field *Chamber Of Commerce Registration Number* to partners. diff --git a/partner_coc/readme/USAGE.rst b/partner_coc/readme/USAGE.rst new file mode 100644 index 000000000..01268785f --- /dev/null +++ b/partner_coc/readme/USAGE.rst @@ -0,0 +1,4 @@ +To use this module, you need to: + +#. Go to the partner form; +#. make sure the partner is a company. diff --git a/partner_coc/tests/__init__.py b/partner_coc/tests/__init__.py new file mode 100644 index 000000000..29c320bdf --- /dev/null +++ b/partner_coc/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_partner_coc diff --git a/partner_coc/tests/test_partner_coc.py b/partner_coc/tests/test_partner_coc.py new file mode 100644 index 000000000..b7187a49c --- /dev/null +++ b/partner_coc/tests/test_partner_coc.py @@ -0,0 +1,64 @@ +# Copyright 2018 Onestein () +# 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') diff --git a/partner_coc/views/res_partner_view.xml b/partner_coc/views/res_partner_view.xml index ec18cb749..d9d0553ad 100644 --- a/partner_coc/views/res_partner_view.xml +++ b/partner_coc/views/res_partner_view.xml @@ -1,8 +1,7 @@ - + - - view.partner.form + res.partner