Browse Source

[MIG] partner_contact_lang: Migration to 12.0

Backport from v13

- Remove stuff related to `active_lang_count`, which doesn't exist in v12.
- Properly pass parent lang to children. Workaround https://github.com/odoo/odoo/issues/53738.

@Tecnativa TT24503
12.0
Jairo Llopis 4 years ago
committed by Pedro M. Baeza
parent
commit
70daebdcfa
  1. 1
      oca_dependencies.txt
  2. 28
      partner_contact_lang/README.rst
  3. 4
      partner_contact_lang/__manifest__.py
  4. 10
      partner_contact_lang/models/res_partner.py
  5. 5
      partner_contact_lang/readme/CONTRIBUTORS.rst
  6. 2
      partner_contact_lang/readme/INSTALL.rst
  7. 3
      partner_contact_lang/readme/ROADMAP.rst
  8. 50
      partner_contact_lang/static/description/index.html
  9. 11
      partner_contact_lang/views/res_partner_view.xml

1
oca_dependencies.txt

@ -0,0 +1 @@
server-tools

28
partner_contact_lang/README.rst

@ -14,13 +14,13 @@ Manage language in contacts
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/13.0/partner_contact_lang
:target: https://github.com/OCA/partner-contact/tree/12.0/partner_contact_lang
:alt: OCA/partner-contact :alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_contact_lang
:target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_contact_lang
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/134/13.0
:target: https://runbot.odoo-community.org/runbot/134/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -44,19 +44,32 @@ set the new conctact with a different language if needed.
.. contents:: .. contents::
:local: :local:
Installation
============
This module depends on ``base_view_inheritance_extension``, available in
`OCA/server-tools <https://github.com/OCA/server-tools>`__.
Usage Usage
===== =====
#. Go to any company partner has contacts. #. Go to any company partner has contacts.
#. Click on any contact and you will be able to edit the language. #. Click on any contact and you will be able to edit the language.
Known issues / Roadmap
======================
* When https://github.com/odoo/odoo/issues/53738 is fixed, remove the
``partner_lang`` field and the dependency on
``base_view_inheritance_extension``.
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/issues>`_. 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. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_contact_lang%0Aversion:%2013.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_contact_lang%0Aversion:%2012.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. Do not contact contributors directly about support or help with technical issues.
@ -71,13 +84,14 @@ Authors
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Javier Iniesta
* Pedro Evaristo Gonzalez Sanchez <pedro.gonzalez@pesol.es>
* `Tecnativa <https://www.tecnativa.com>`__: * `Tecnativa <https://www.tecnativa.com>`__:
* Javier Iniesta
* Vicent Cubells * Vicent Cubells
* David Vidal * David Vidal
* Cristina Martín * Cristina Martín
* Pedro Evaristo Gonzalez Sanchez <pedro.gonzalez@pesol.es>
* Jairo Llopis
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -92,6 +106,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/13.0/partner_contact_lang>`_ project on GitHub.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/12.0/partner_contact_lang>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

4
partner_contact_lang/__manifest__.py

@ -5,12 +5,12 @@
{ {
"name": "Manage language in contacts", "name": "Manage language in contacts",
"version": "13.0.1.0.0",
"version": "12.0.1.0.0",
"category": "Sales", "category": "Sales",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Tecnativa," "Odoo Community Association (OCA)", "author": "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/partner-contact/", "website": "https://github.com/OCA/partner-contact/",
"depends": ["base"],
"depends": ["base_view_inheritance_extension"],
"data": ["views/res_partner_view.xml"], "data": ["views/res_partner_view.xml"],
"installable": True, "installable": True,
} }

10
partner_contact_lang/models/res_partner.py

@ -2,12 +2,20 @@
# Copyright 2017 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com> # Copyright 2017 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models
from odoo import api, fields, models
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = "res.partner" _inherit = "res.partner"
# HACK https://github.com/odoo/odoo/issues/53738
# TODO Remove when fixed
partner_lang = fields.Selection(
string="Partner lang",
related="lang",
readonly=True,
)
def write(self, vals): def write(self, vals):
"""Propagate a language change in the partner to the child contacts.""" """Propagate a language change in the partner to the child contacts."""
res = super(ResPartner, self).write(vals) res = super(ResPartner, self).write(vals)

5
partner_contact_lang/readme/CONTRIBUTORS.rst

@ -1,7 +1,8 @@
* Javier Iniesta
* Pedro Evaristo Gonzalez Sanchez <pedro.gonzalez@pesol.es>
* `Tecnativa <https://www.tecnativa.com>`__: * `Tecnativa <https://www.tecnativa.com>`__:
* Javier Iniesta
* Vicent Cubells * Vicent Cubells
* David Vidal * David Vidal
* Cristina Martín * Cristina Martín
* Pedro Evaristo Gonzalez Sanchez <pedro.gonzalez@pesol.es>
* Jairo Llopis

2
partner_contact_lang/readme/INSTALL.rst

@ -0,0 +1,2 @@
This module depends on ``base_view_inheritance_extension``, available in
`OCA/server-tools <https://github.com/OCA/server-tools>`__.

3
partner_contact_lang/readme/ROADMAP.rst

@ -0,0 +1,3 @@
* When https://github.com/odoo/odoo/issues/53738 is fixed, remove the
``partner_lang`` field and the dependency on
``base_view_inheritance_extension``.

50
partner_contact_lang/static/description/index.html

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/partner-contact/tree/13.0/partner_contact_lang"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-13-0/partner-contact-13-0-partner_contact_lang"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/134/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/partner-contact/tree/12.0/partner_contact_lang"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_contact_lang"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/134/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Odoo by default propagate language field to the created contacts from their <p>Odoo by default propagate language field to the created contacts from their
form, but it doesn’t allow to change it once created.</p> form, but it doesn’t allow to change it once created.</p>
<p>This module fills this gap, and also provides other facilities for the <p>This module fills this gap, and also provides other facilities for the
@ -382,60 +382,76 @@ set the new conctact with a different language if needed.
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="id3">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#id1">Installation</a></h1>
<p>This module depends on <tt class="docutils literal">base_view_inheritance_extension</tt>, available in
<a class="reference external" href="https://github.com/OCA/server-tools">OCA/server-tools</a>.</p>
</div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to any company partner has contacts.</li> <li>Go to any company partner has contacts.</li>
<li>Click on any contact and you will be able to edit the language.</li> <li>Click on any contact and you will be able to edit the language.</li>
</ol> </ol>
</div> </div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>When <a class="reference external" href="https://github.com/odoo/odoo/issues/53738">https://github.com/odoo/odoo/issues/53738</a> is fixed, remove the
<tt class="docutils literal">partner_lang</tt> field and the dependency on
<tt class="docutils literal">base_view_inheritance_extension</tt>.</li>
</ul>
</div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/partner-contact/issues">GitHub Issues</a>. <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. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/partner-contact/issues/new?body=module:%20partner_contact_lang%0Aversion:%2013.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_contact_lang%0Aversion:%2012.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<h1><a class="toc-backref" href="#id5">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<h2><a class="toc-backref" href="#id6">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Tecnativa</li> <li>Tecnativa</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Javier Iniesta</li> <li>Javier Iniesta</li>
<li>Pedro Evaristo Gonzalez Sanchez &lt;<a class="reference external" href="mailto:pedro.gonzalez&#64;pesol.es">pedro.gonzalez&#64;pesol.es</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Vicent Cubells</li> <li>Vicent Cubells</li>
<li>David Vidal</li> <li>David Vidal</li>
<li>Cristina Martín</li> <li>Cristina Martín</li>
<li>Pedro Evaristo Gonzalez Sanchez &lt;<a class="reference external" href="mailto:pedro.gonzalez&#64;pesol.es">pedro.gonzalez&#64;pesol.es</a>&gt;</li>
<li>Jairo Llopis</li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <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 <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/partner-contact/tree/13.0/partner_contact_lang">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/12.0/partner_contact_lang">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> <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>
</div> </div>

11
partner_contact_lang/views/res_partner_view.xml

@ -12,13 +12,20 @@
expr="//field[@name='child_ids']/form/sheet/field[@name='lang']" expr="//field[@name='child_ids']/form/sheet/field[@name='lang']"
position="replace" position="replace"
> >
<field name="active_lang_count" invisible="1" />
<group attrs="{'invisible': [('active_lang_count', '&lt;=', 1)]}">
<group>
<group> <group>
<field name="lang" /> <field name="lang" />
</group> </group>
</group> </group>
</xpath> </xpath>
<!-- HACK https://github.com/odoo/odoo/issues/53738
TODO Remove when fixed -->
<field name="lang" position="after">
<field name="partner_lang" invisible="1"/>
</field>
<field name="child_ids" position="attributes">
<attribute name="context" operation="python_dict" key="default_lang">partner_lang</attribute>
</field>
</field> </field>
</record> </record>
<record id="view_res_partner_filter" model="ir.ui.view"> <record id="view_res_partner_filter" model="ir.ui.view">

Loading…
Cancel
Save