Skip to content

Commit

Permalink
Merge PR #1958 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rafaelbn
  • Loading branch information
OCA-git-bot committed Jan 27, 2025
2 parents 6416098 + e94c4ef commit 870b938
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 76 deletions.
11 changes: 9 additions & 2 deletions partner_industry_secondary/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Partner Industry Secondary

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds secondary industries for partners.
This module adds a second field *Secondary Industries* behind the Odoo core one *Main Industry*.
Also this module allow hierarchy of industries.

**Table of contents**

Expand All @@ -45,14 +46,19 @@ To manage industries, you need to:
By default only companies have industries. To activate industries in individuals also,
you need to activate the following setting:

* Go to *Settings > General Settings > Partner Industries > Industry in contacts > Use industry for individuals*
* Go to *Settings > General Settings > Contacts > Enable industries for individuals*

To display Child Industries first, you need to activate the following setting:

* Go to *Settings > General Settings > Contacts > Display Child Industries first*

Usage
=====

To use this module, you need to:

* Go to any partner's form.
* Set the secondary industries.

Bug Tracker
===========
Expand Down Expand Up @@ -84,6 +90,7 @@ Contributors
* Jordi Ballester Alomar <[email protected]>
* Miquel Raïch <[email protected]>
* Cristina Martin R.
* Eduardo de Miguel <[email protected]> (`Moduon <https://www.moduon.team/>`__)

Maintainers
~~~~~~~~~~~
Expand Down
90 changes: 32 additions & 58 deletions partner_industry_secondary/i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_sector
# * partner_industry_secondary
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-26 15:33+0000\n"
"PO-Revision-Date: 2023-10-12 13:38+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"POT-Creation-Date: 2025-01-15 09:17+0000\n"
"PO-Revision-Date: 2025-01-15 10:18+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4.4\n"

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_partner_industry__child_ids
Expand All @@ -27,13 +25,24 @@ msgstr "Hijos"
#. module: partner_industry_secondary
#: model:ir.model,name:partner_industry_secondary.model_res_config_settings
msgid "Config Settings"
msgstr "Configura los ajustes"
msgstr "Ajustes de configuración"

#. module: partner_industry_secondary
#: model:ir.model,name:partner_industry_secondary.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_config_settings__display_last_child_first
#: model_terms:ir.ui.view,arch_db:partner_industry_secondary.res_config_settings_view_form
msgid "Display Child Industries first"
msgstr "Mostrar Industrias Hijas primero"

#. module: partner_industry_secondary
#: model_terms:ir.ui.view,arch_db:partner_industry_secondary.res_config_settings_view_form
msgid "Display like: Child (Parent &lt; Grandparent)"
msgstr "Mostrar como: Hijo (Padre &lt; Abuelo)"

#. module: partner_industry_secondary
#: model_terms:ir.ui.view,arch_db:partner_industry_secondary.res_config_settings_view_form
msgid "Enable industries for individuals"
Expand Down Expand Up @@ -61,7 +70,7 @@ msgstr "Sector"
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_partner__industry_id
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_users__industry_id
msgid "Main Industry"
msgstr "Sector principal"
msgstr "Sector"

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_partner_industry__name
Expand Down Expand Up @@ -94,6 +103,15 @@ msgstr "Sector"
msgid "Set if you want to be able to use industries for individuals also."
msgstr "Establezca si desea poder usar sectores para individuos también."

#. module: partner_industry_secondary
#: model:ir.model.fields,help:partner_industry_secondary.field_res_config_settings__display_last_child_first
msgid ""
"Set if you want to show the last child industries first when displaying industries.\n"
"Child (Parent < Grandparent)"
msgstr ""
"Márcalo si quieres mostrar la última industria hija primero cuando busques por industrias.\n"
"Hija (Padre < Abuelo < Ancestro)"

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_partner__show_partner_industry_for_person
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_users__show_partner_industry_for_person
Expand All @@ -105,54 +123,10 @@ msgstr "Mostrar socio Industria Para persona"
#: code:addons/partner_industry_secondary/models/res_partner.py:0
#, python-format
msgid "The main industry must be different from the secondary industries."
msgstr ""
"La industria principal debe ser diferente de las industrias secundarias."
msgstr "La industria principal debe ser diferente de las industrias secundarias."

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_config_settings__group_use_partner_industry_for_person
#: model:res.groups,name:partner_industry_secondary.group_use_partner_industry_for_person
msgid "Use industry for individuals"
msgstr "Use el sector para individuos"

#, python-format
#~ msgid "Error! You cannot create recursive industries."
#~ msgstr "Error!. No puede crear sectores recursivos."

#~ msgid "Industry for individual"
#~ msgstr "Sector para personas"

#~ msgid "Partner Industries"
#~ msgstr "Sectores de la empresa"

#~ msgid "Parent Right"
#~ msgstr "Padre derecha"

#~ msgid "Created by"
#~ msgstr "Creado por"

#~ msgid "Created on"
#~ msgstr "Creado en"

#~ msgid "Display Name"
#~ msgstr "Nombre mostrado"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última modificación el"

#~ msgid "Last Updated by"
#~ msgstr "Última actualización por"

#~ msgid "Last Updated on"
#~ msgstr "Última actualización en"

#~ msgid "Main Sector"
#~ msgstr "Sector principal"

#~ msgid "Partner"
#~ msgstr "Empresa"

#~ msgid "Sectors"
#~ msgstr "Sectores"
22 changes: 21 additions & 1 deletion partner_industry_secondary/i18n/partner_industry_secondary.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-15 09:17+0000\n"
"PO-Revision-Date: 2025-01-15 09:17+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -28,6 +30,17 @@ msgstr ""
msgid "Contact"
msgstr ""

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_config_settings__display_last_child_first
#: model_terms:ir.ui.view,arch_db:partner_industry_secondary.res_config_settings_view_form
msgid "Display Child Industries first"
msgstr ""

#. module: partner_industry_secondary
#: model_terms:ir.ui.view,arch_db:partner_industry_secondary.res_config_settings_view_form
msgid "Display like: Child (Parent &lt; Grandparent)"
msgstr ""

#. module: partner_industry_secondary
#: model_terms:ir.ui.view,arch_db:partner_industry_secondary.res_config_settings_view_form
msgid "Enable industries for individuals"
Expand Down Expand Up @@ -88,6 +101,13 @@ msgstr ""
msgid "Set if you want to be able to use industries for individuals also."
msgstr ""

#. module: partner_industry_secondary
#: model:ir.model.fields,help:partner_industry_secondary.field_res_config_settings__display_last_child_first
msgid ""
"Set if you want to show the last child industries first when displaying industries.\n"
"Child (Parent < Grandparent)"
msgstr ""

#. module: partner_industry_secondary
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_partner__show_partner_industry_for_person
#: model:ir.model.fields,field_description:partner_industry_secondary.field_res_users__show_partner_industry_for_person
Expand Down
7 changes: 7 additions & 0 deletions partner_industry_secondary/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# Copyright 2025 Moduon - Eduardo de Miguel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models
Expand All @@ -12,3 +13,9 @@ class ResConfigSettings(models.TransientModel):
help="Set if you want to be able to use industries for individuals also.",
implied_group="partner_industry_secondary.group_use_partner_industry_for_person",
)
display_last_child_first = fields.Boolean(
string="Display Child Industries first",
help="Set if you want to show the last child industries first "
"when displaying industries.\nChild (Parent < Grandparent)",
config_parameter="partner_industry_secondary.display_last_child_first",
)
19 changes: 17 additions & 2 deletions partner_industry_secondary/models/res_partner_industry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright 2016 Tecnativa S.L. - Pedro M. Baeza
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# Copyright 2019 Tecnativa - Cristina Martin R.
# Copyright 2025 Moduon - Eduardo de Miguel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import _, api, exceptions, fields, models
Expand All @@ -28,11 +29,25 @@ def get_names(cat):
"""Return the list [cat.name, cat.parent_id.name, ...]"""
res = []
while cat:
res.insert(0, cat.name)
res.append(cat.name)
cat = cat.parent_id
return res

return [(cat.id, " / ".join(get_names(cat))) for cat in self]
if (
self.env["ir.config_parameter"]
.sudo()
.get_param("partner_industry_secondary.display_last_child_first")
):
# Display last child first
result = []
for cat in self:
cat_name, *parent_cats = get_names(cat)
if parent_cats:
cat_name = f"{cat_name} ({' < '.join(parent_cats)})"
result.append((cat.id, cat_name))
return result
# Default display (Grandparent / Parent / Child)
return [(cat.id, " / ".join(get_names(cat)[::-1])) for cat in self]

@api.constrains("name", "parent_id")
def _check_uniq_name(self):
Expand Down
6 changes: 5 additions & 1 deletion partner_industry_secondary/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ To manage industries, you need to:
By default only companies have industries. To activate industries in individuals also,
you need to activate the following setting:

* Go to *Settings > General Settings > Partner Industries > Industry in contacts > Use industry for individuals*
* Go to *Settings > General Settings > Contacts > Enable industries for individuals*

To display Child Industries first, you need to activate the following setting:

* Go to *Settings > General Settings > Contacts > Display Child Industries first*
1 change: 1 addition & 0 deletions partner_industry_secondary/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
* Jordi Ballester Alomar <[email protected]>
* Miquel Raïch <[email protected]>
* Cristina Martin R.
* Eduardo de Miguel <[email protected]> (`Moduon <https://www.moduon.team/>`__)
3 changes: 2 additions & 1 deletion partner_industry_secondary/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
This module adds secondary industries for partners.
This module adds a second field *Secondary Industries* behind the Odoo core one *Main Industry*.
Also this module allow hierarchy of industries.
1 change: 1 addition & 0 deletions partner_industry_secondary/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
To use this module, you need to:

* Go to any partner's form.
* Set the secondary industries.
22 changes: 16 additions & 6 deletions partner_industry_secondary/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,7 +370,8 @@ <h1 class="title">Partner Industry Secondary</h1>
!! source digest: sha256:239d219b7b25c790698cd580d9091e16c51cd2ba4e638677df6f35827168b0d6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/partner-contact/tree/16.0/partner_industry_secondary"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/partner-contact-16-0/partner-contact-16-0-partner_industry_secondary"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/partner-contact&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds secondary industries for partners.</p>
<p>This module adds a second field <em>Secondary Industries</em> behind the Odoo core one <em>Main Industry</em>.
Also this module allow hierarchy of industries.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -393,14 +395,19 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>By default only companies have industries. To activate industries in individuals also,
you need to activate the following setting:</p>
<ul class="simple">
<li>Go to <em>Settings &gt; General Settings &gt; Partner Industries &gt; Industry in contacts &gt; Use industry for individuals</em></li>
<li>Go to <em>Settings &gt; General Settings &gt; Contacts &gt; Enable industries for individuals</em></li>
</ul>
<p>To display Child Industries first, you need to activate the following setting:</p>
<ul class="simple">
<li>Go to <em>Settings &gt; General Settings &gt; Contacts &gt; Display Child Industries first</em></li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, you need to:</p>
<ul class="simple">
<li>Go to any partner’s form.</li>
<li>Set the secondary industries.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
Expand Down Expand Up @@ -431,12 +438,15 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Jordi Ballester Alomar &lt;<a class="reference external" href="mailto:jordi.ballester&#64;eficent.com">jordi.ballester&#64;eficent.com</a>&gt;</li>
<li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;eficent.com">miquel.raich&#64;eficent.com</a>&gt;</li>
<li>Cristina Martin R.</li>
<li>Eduardo de Miguel &lt;<a class="reference external" href="mailto:hola&#64;moduon.team">hola&#64;moduon.team</a>&gt; (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
Loading

0 comments on commit 870b938

Please sign in to comment.