Denis Roussel
8 years ago
committed by
Gilles Meyomesse
13 changed files with 253 additions and 0 deletions
-
61partner_company_type/README.rst
-
1partner_company_type/__init__.py
-
24partner_company_type/__manifest__.py
-
9partner_company_type/demo/res_partner_company_type.xml
-
2partner_company_type/models/__init__.py
-
12partner_company_type/models/res_partner.py
-
17partner_company_type/models/res_partner_company_type.py
-
25partner_company_type/security/res_partner_company_type.xml
-
BINpartner_company_type/static/description/icon.png
-
4partner_company_type/tests/__init__.py
-
29partner_company_type/tests/test_company_type.py
-
18partner_company_type/views/res_partner.xml
-
51partner_company_type/views/res_partner_company_type.xml
@ -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 |
|||
<https://github.com/OCA/partner-contact/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Denis Roussel <denis.roussel@acsone.eu> |
|||
|
|||
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. |
@ -0,0 +1 @@ |
|||
from . import models |
@ -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', |
|||
], |
|||
} |
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2017 ACSONE SA/NV |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo noupdate="1"> |
|||
<record model="res.partner.company.type" id="res_partner_company_type_sa"> |
|||
<field name="name">Anonymous Company</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,2 @@ |
|||
from . import res_partner_company_type |
|||
from . import res_partner |
@ -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') |
@ -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 !")] |
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2017 ACSONE SA/NV |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
<record model="ir.model.access" id="res_partner_company_type_user"> |
|||
<field name="name">res.partner.company.type base</field> |
|||
<field name="model_id" ref="model_res_partner_company_type"/> |
|||
<field name="group_id" ref="base.group_user"/> |
|||
<field name="perm_read" eval="1"/> |
|||
<field name="perm_create" eval="0"/> |
|||
<field name="perm_write" eval="0"/> |
|||
<field name="perm_unlink" eval="0"/> |
|||
</record> |
|||
|
|||
<record model="ir.model.access" id="res_partner_company_type_manager"> |
|||
<field name="name">res.partner.company.type manager</field> |
|||
<field name="model_id" ref="model_res_partner_company_type"/> |
|||
<field name="group_id" ref="base.group_partner_manager"/> |
|||
<field name="perm_read" eval="1"/> |
|||
<field name="perm_create" eval="1"/> |
|||
<field name="perm_write" eval="1"/> |
|||
<field name="perm_unlink" eval="1"/> |
|||
</record> |
|||
</odoo> |
After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -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 |
@ -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) |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2017 ACSONE SA/NV |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="view_partner_company_type_form" model="ir.ui.view"> |
|||
<field name="name">res.partner.form</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="title" position="after"> |
|||
<field name="company_type_id" options='{"no_open": True}' |
|||
attrs="{'invisible': [('is_company', '=', False)]}"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,51 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2017 ACSONE SA/NV |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
<record model="ir.ui.view" id="res_partner_company_type_form_view"> |
|||
<field name="name">res.partner.company.type.form (in partner_company_type)</field> |
|||
<field name="model">res.partner.company.type</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Company Types"> |
|||
<group col="4"> |
|||
<field name="name"/> |
|||
<field name="shortcut"/> |
|||
</group> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.ui.view" id="res_partner_company_type_search_view"> |
|||
<field name="name">res.partner.company.type.search (in partner_company_type)</field> |
|||
<field name="model">res.partner.company.type</field> |
|||
<field name="arch" type="xml"> |
|||
<search> |
|||
<field name="name"/> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.ui.view" id="res_partner_company_type_tree_view"> |
|||
<field name="name">res.partner.company.type.tree (in partner_company_type)</field> |
|||
<field name="model">res.partner.company.type</field> |
|||
<field name="arch" type="xml"> |
|||
<tree> |
|||
<field name="name"/> |
|||
<field name="shortcut"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.actions.act_window" id="res_partner_company_type_act_window"> |
|||
<field name="name">Company Types</field> |
|||
<field name="res_model">res.partner.company.type</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="domain">[]</field> |
|||
<field name="context">{}</field> |
|||
</record> |
|||
|
|||
<!-- Odoo put partner title menu in sales_team... --> |
|||
<menuitem action="res_partner_company_type_act_window" id="menu_partner_company_type" name="Company Types" parent="sales_team.menu_config_address_book" sequence="4" groups="base.group_no_one"/> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue