diff --git a/partner_company_type/README.rst b/partner_company_type/README.rst new file mode 100644 index 000000000..2f7f1caa9 --- /dev/null +++ b/partner_company_type/README.rst @@ -0,0 +1,61 @@ +.. 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 Company Type +==================== + +Adds a title to partner that are companies. +(Before: Partner Title in Odoo - limited to contacts now) + +See : + :target: https://en.wikipedia.org/wiki/Types_of_business_entity + +Usage +===== + + +.. 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 + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + + +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. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Denis Roussel + +Maintainer +---------- + +.. 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. diff --git a/partner_company_type/__init__.py b/partner_company_type/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/partner_company_type/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/partner_company_type/__manifest__.py b/partner_company_type/__manifest__.py new file mode 100644 index 000000000..cd8b9237e --- /dev/null +++ b/partner_company_type/__manifest__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Partner Company Type', + 'summary': """ + Adds a company type to partner that are companies""", + 'version': '10.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', + 'website': 'https://acsone.eu', + 'depends': ['base', + 'sales_team' + ], + 'data': [ + 'security/res_partner_company_type.xml', + 'views/res_partner_company_type.xml', + 'views/res_partner.xml', + ], + 'demo': [ + 'demo/res_partner_company_type.xml', + ], +} diff --git a/partner_company_type/demo/res_partner_company_type.xml b/partner_company_type/demo/res_partner_company_type.xml new file mode 100644 index 000000000..0c4e92d19 --- /dev/null +++ b/partner_company_type/demo/res_partner_company_type.xml @@ -0,0 +1,9 @@ + + + + + + Anonymous Company + + diff --git a/partner_company_type/models/__init__.py b/partner_company_type/models/__init__.py new file mode 100644 index 000000000..7dc16e0aa --- /dev/null +++ b/partner_company_type/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_partner_company_type +from . import res_partner diff --git a/partner_company_type/models/res_partner.py b/partner_company_type/models/res_partner.py new file mode 100644 index 000000000..fcc6569e1 --- /dev/null +++ b/partner_company_type/models/res_partner.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + company_type_id = fields.Many2one('res.partner.company.type', + string='Company Type') diff --git a/partner_company_type/models/res_partner_company_type.py b/partner_company_type/models/res_partner_company_type.py new file mode 100644 index 000000000..06990e08a --- /dev/null +++ b/partner_company_type/models/res_partner_company_type.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartnerCompanyType(models.Model): + + _name = 'res.partner.company.type' + _description = 'Partner Company Type' + + name = fields.Char(string='Title', required=True, translate=True) + shortcut = fields.Char(string='Abbreviation', translate=True) + + _sql_constraints = [('name_uniq', 'unique (name)', + "Partner Company Type already exists !")] diff --git a/partner_company_type/security/res_partner_company_type.xml b/partner_company_type/security/res_partner_company_type.xml new file mode 100644 index 000000000..12b7ae58d --- /dev/null +++ b/partner_company_type/security/res_partner_company_type.xml @@ -0,0 +1,25 @@ + + + + + + res.partner.company.type base + + + + + + + + + + res.partner.company.type manager + + + + + + + + diff --git a/partner_company_type/static/description/icon.png b/partner_company_type/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/partner_company_type/static/description/icon.png differ diff --git a/partner_company_type/tests/__init__.py b/partner_company_type/tests/__init__.py new file mode 100644 index 000000000..89e75be6c --- /dev/null +++ b/partner_company_type/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import test_company_type diff --git a/partner_company_type/tests/test_company_type.py b/partner_company_type/tests/test_company_type.py new file mode 100644 index 000000000..c1271368e --- /dev/null +++ b/partner_company_type/tests/test_company_type.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Copyright 2016 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import TransactionCase +from psycopg2 import IntegrityError + + +class CompanyTypeTest(TransactionCase): + + def setUp(self): + super(CompanyTypeTest, self).setUp() + + vals = {'name': 'Limited Corporation', + 'shortcut': 'Ltd.'} + + c_type_obj = self.env['res.partner.company.type'] + + self.type_ltd = c_type_obj.create(vals) + + def test_00_duplicate(self): + # Test Duplicate type + vals = {'name': 'Limited Corporation', + 'shortcut': 'Ltd.'} + + c_type_obj = self.env['res.partner.company.type'] + + with self.assertRaises(IntegrityError): + c_type_obj.create(vals) diff --git a/partner_company_type/views/res_partner.xml b/partner_company_type/views/res_partner.xml new file mode 100644 index 000000000..2f2a84aaa --- /dev/null +++ b/partner_company_type/views/res_partner.xml @@ -0,0 +1,18 @@ + + + + + + + res.partner.form + res.partner + + + + + + + + \ No newline at end of file diff --git a/partner_company_type/views/res_partner_company_type.xml b/partner_company_type/views/res_partner_company_type.xml new file mode 100644 index 000000000..51e1dccc2 --- /dev/null +++ b/partner_company_type/views/res_partner_company_type.xml @@ -0,0 +1,51 @@ + + + + + + res.partner.company.type.form (in partner_company_type) + res.partner.company.type + +
+ + + + +
+
+
+ + + res.partner.company.type.search (in partner_company_type) + res.partner.company.type + + + + + + + + + res.partner.company.type.tree (in partner_company_type) + res.partner.company.type + + + + + + + + + + Company Types + res.partner.company.type + tree,form + [] + {} + + + + + +