From a2af8ad628da3988f0a1c5368d5c154cbfd412ce Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Sun, 5 Aug 2018 14:38:54 +0200 Subject: [PATCH] partner_sector: allow to use in individuals --- partner_sector/README.rst | 12 +++- partner_sector/__manifest__.py | 3 + partner_sector/models/__init__.py | 2 + partner_sector/models/base_config_settings.py | 14 +++++ partner_sector/models/sale_config_settings.py | 14 +++++ .../security/partner_sector_security.xml | 7 +++ partner_sector/views/base_config_settings.xml | 21 +++++++ partner_sector/views/res_partner_view.xml | 55 +++++++++++++++++++ partner_sector/views/sale_config_settings.xml | 19 +++++++ 9 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 partner_sector/models/base_config_settings.py create mode 100644 partner_sector/models/sale_config_settings.py create mode 100644 partner_sector/security/partner_sector_security.xml create mode 100644 partner_sector/views/base_config_settings.xml create mode 100644 partner_sector/views/sale_config_settings.xml diff --git a/partner_sector/README.rst b/partner_sector/README.rst index a75e80363..a4bcf85e0 100644 --- a/partner_sector/README.rst +++ b/partner_sector/README.rst @@ -16,6 +16,15 @@ To manage sectors, you need to: * Go to *Sales > Configuration > Contacts > Sectors*. +By default only companies have sectors. To activate sectors in individuals also, +you need to activate the following setting: + +* Go to *Settings > General Settings > Sector in contacts > Use sector for individuals* + +Or, if you have *Sales* or *CRM* modules installed: + +* Go to *Sales > Configuration > Settings > Partner Sector > Use sector for individuals* + Usage ===== @@ -24,8 +33,6 @@ To use this module, you need to: * Go to any partner's form. -Only companies have sectors. - .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot @@ -56,6 +63,7 @@ Contributors * Vicent Cubells * Pedro M. Baeza * Luis M. Ontalba +* Jordi Ballester Alomar Maintainer ---------- diff --git a/partner_sector/__manifest__.py b/partner_sector/__manifest__.py index 3d939fa41..39a54ffbf 100644 --- a/partner_sector/__manifest__.py +++ b/partner_sector/__manifest__.py @@ -18,7 +18,10 @@ ], "data": [ "security/ir.model.access.csv", + "security/partner_sector_security.xml", "views/res_partner_sector_view.xml", "views/res_partner_view.xml", + "views/base_config_settings.xml", + "views/sale_config_settings.xml" ] } diff --git a/partner_sector/models/__init__.py b/partner_sector/models/__init__.py index 7976185ff..a265df98f 100644 --- a/partner_sector/models/__init__.py +++ b/partner_sector/models/__init__.py @@ -5,3 +5,5 @@ from . import res_partner from . import res_partner_sector +from . import base_config_settings +from . import sale_config_settings diff --git a/partner_sector/models/base_config_settings.py b/partner_sector/models/base_config_settings.py new file mode 100644 index 000000000..e5733a7eb --- /dev/null +++ b/partner_sector/models/base_config_settings.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Eficent Business and IT Consulting Services, S.L. + +from odoo import fields, models + + +class BaseConfigSettings(models.TransientModel): + _inherit = 'base.config.settings' + + group_use_partner_sector_for_person = fields.Boolean( + 'Use sector for individuals', + help="Set if you want to be able use sectors for " + "individuals also.", + implied_group='partner_sector.group_use_partner_sector_for_person') diff --git a/partner_sector/models/sale_config_settings.py b/partner_sector/models/sale_config_settings.py new file mode 100644 index 000000000..ff78cc09a --- /dev/null +++ b/partner_sector/models/sale_config_settings.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Eficent Business and IT Consulting Services, S.L. + +from odoo import fields, models + + +class SaleConfigSettings(models.TransientModel): + _inherit = 'sale.config.settings' + + group_use_partner_sector_for_person = fields.Boolean( + 'Use sector for individuals', + help="Set if you want to be able to use sectors for " + "individuals also.", + implied_group='partner_sector.group_use_partner_sector_for_person') diff --git a/partner_sector/security/partner_sector_security.xml b/partner_sector/security/partner_sector_security.xml new file mode 100644 index 000000000..a7d31318b --- /dev/null +++ b/partner_sector/security/partner_sector_security.xml @@ -0,0 +1,7 @@ + + + + Use sector for individuals + + + diff --git a/partner_sector/views/base_config_settings.xml b/partner_sector/views/base_config_settings.xml new file mode 100644 index 000000000..815f7b261 --- /dev/null +++ b/partner_sector/views/base_config_settings.xml @@ -0,0 +1,21 @@ + + + + + General Settings + base.config.settings + + + + + + + + + + diff --git a/partner_sector/views/res_partner_view.xml b/partner_sector/views/res_partner_view.xml index 2f433196f..bfe9c6325 100644 --- a/partner_sector/views/res_partner_view.xml +++ b/partner_sector/views/res_partner_view.xml @@ -15,6 +15,14 @@ + + + + + @@ -50,4 +58,51 @@ + + + + Partner form with sector + res.partner + + + + + {'invisible': 0} + + + {'invisible': 0} + + + {'invisible': 0} + + + {'invisible': 0} + + + + + + Partner tree with sector + res.partner + + + + + {'invisible': 0} + + + + + + Partner search with sector + res.partner + + + + + + + + + diff --git a/partner_sector/views/sale_config_settings.xml b/partner_sector/views/sale_config_settings.xml new file mode 100644 index 000000000..9fd708b56 --- /dev/null +++ b/partner_sector/views/sale_config_settings.xml @@ -0,0 +1,19 @@ + + + + partner sector settings + sale.config.settings + + +
+ + +
+
+
+