Skip to content

Commit

Permalink
[MIG] partner_industry_secondary: Migration to 18.0
Browse files Browse the repository at this point in the history
[IMP] Environment._ for translations and view improvements
  • Loading branch information
achulii committed Nov 26, 2024
1 parent e475b08 commit 2787d92
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion partner_industry_secondary/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ 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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_industry_secondary%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_industry_secondary%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down
2 changes: 1 addition & 1 deletion partner_industry_secondary/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Partner Industry Secondary",
"summary": "Add secondary partner industries",
"version": "17.0.1.1.1",
"version": "18.0.1.0.0",
"category": "Sales",
"website": "https://github.com/OCA/partner-contact",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
4 changes: 2 additions & 2 deletions partner_industry_secondary/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import _, api, exceptions, fields, models
from odoo import api, exceptions, fields, models


class ResPartner(models.Model):
Expand Down Expand Up @@ -32,7 +32,7 @@ def _check_industries(self):
for partner in self:
if partner.industry_id in partner.secondary_industry_ids:
raise exceptions.ValidationError(
_(
self.env._(
"The main industry must be different "
"from the secondary industries."
)
Expand Down
6 changes: 3 additions & 3 deletions partner_industry_secondary/models/res_partner_industry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright 2019 Tecnativa - Cristina Martin R.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import _, api, exceptions, fields, models
from odoo import api, exceptions, fields, models


class ResPartnerIndustry(models.Model):
Expand All @@ -22,7 +22,7 @@ class ResPartnerIndustry(models.Model):
child_ids = fields.One2many(
comodel_name="res.partner.industry", inverse_name="parent_id", string="Children"
)
parent_path = fields.Char(index=True, unaccent=False)
parent_path = fields.Char(index=True)

@api.depends("name", "parent_id", "parent_id.display_name")
def _compute_display_name(self):
Expand All @@ -41,7 +41,7 @@ def _check_uniq_name(self):
> 1
):
raise exceptions.ValidationError(
_("Error! Industry with same name and parent already exists.")
self.env._("Error! Industry with same name and parent already exists.")
)

def copy(self, default=None):
Expand Down
6 changes: 3 additions & 3 deletions partner_industry_secondary/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Partner Industry Secondary</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5712191e7c7ed204c3bdd5737659a852e3121c649b954bb6e22d635b7a80154d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/17.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-17-0/partner-contact-17-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=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/18.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-18-0/partner-contact-18-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=18.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><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -410,7 +410,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/partner-contact/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_industry_secondary%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_industry_secondary%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -444,7 +444,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<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>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/17.0/partner_industry_secondary">OCA/partner-contact</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/18.0/partner_industry_secondary">OCA/partner-contact</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<field name="model">res.partner.industry</field>
<field name="inherit_id" ref="base.res_partner_industry_view_tree" />
<field name="arch" type="xml">
<tree position="attributes">
<list position="attributes">
<attribute name="editable" />
</tree>
</list>
<field name="name" position="after">
<field name="parent_id" />
</field>
Expand Down
14 changes: 5 additions & 9 deletions partner_industry_secondary/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="industry_id" position="after">
<field name="show_partner_industry_for_person" invisible="1" />
<field
name="secondary_industry_ids"
widget="many2many_tags"
invisible="is_company == False and show_partner_industry_for_person == False"
invisible="not is_company and not show_partner_industry_for_person"
/>
</field>
<field name="industry_id" position="attributes">
<attribute
name="invisible"
>is_company == False and show_partner_industry_for_person == False</attribute>
>not is_company and not show_partner_industry_for_person</attribute>
</field>
<xpath
expr="//field[@name='child_ids']/form//field[@name='title']"
position="after"
>
<field name="is_company" invisible="1" />
<field name="show_partner_industry_for_person" invisible="1" />
<field
name="industry_id"
placeholder="Sector"
options='{"no_open": True}'
invisible="is_company == False and show_partner_industry_for_person == False"
invisible="not is_company and not show_partner_industry_for_person"
/>
<field
name="secondary_industry_ids"
widget="many2many_tags"
invisible="is_company == False and show_partner_industry_for_person == False"
invisible="not is_company and not show_partner_industry_for_person"
/>
</xpath>
</field>
Expand All @@ -49,9 +46,8 @@
<field name="email" position="after">
<field
name="industry_id"
invisible="is_company == False and show_partner_industry_for_person == False"
invisible="not is_company and not show_partner_industry_for_person"
/>
<field name="show_partner_industry_for_person" column_invisible="1" />
</field>
</field>
</record>
Expand Down

0 comments on commit 2787d92

Please sign in to comment.