Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] partner_contact_lang: Manage language in contacts #302

Merged
merged 3 commits into from
Nov 24, 2016

Conversation

pedrobaeza
Copy link
Member

@pedrobaeza pedrobaeza commented Aug 22, 2016

Manage language in contacts

Odoo by default propagate language field to the created contacts from their form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the contact language management:

  • Put the language of the parent company when the contact doesn't have a
    language and this parent company is assigned.
  • When the company changes the language, it fills with the same language all
    the contacts that don't have any.

Usage

Go to any partner that is a company and has contacts. Click on one contact and you will be able to edit the language.

===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
@pedrobaeza
Copy link
Member Author

cc @Tecnativa


@api.multi
def write(self, vals):
if 'lang' in vals and vals['lang']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vals.get("lang") is simpler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not exactly the same. We can do anyway if vals.get('lang') is not None:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I understand what you mean. However, in this case is better vals.get("lang"), because otherwise, if you are editing a parent partner and unsetting its lang, then you would search for all children that have no lang and unset it (which is redundant).

@pedrobaeza
Copy link
Member Author

@yajo, I have fixed your comments

@rafaelbn, please review.

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of not blockers, but if you want to fix them, it will be better 😉

"""Propagate a language change in the partner to the child contacts."""
res = super(ResPartner, self).write(vals)
if vals.get('lang'):
childs = self.mapped('child_ids').filtered(lambda x: not x.lang)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that here you'd better use self.search([('id','child_of',self.ids),('lang','=',False)]), because I remember some addon allowing you to have more than 1 level of "childness" (not sure which ATM).

"""Propagate a language change in the partner to the child contacts."""
res = super(ResPartner, self).write(vals)
if vals.get('lang'):
childs = self.mapped('child_ids').filtered(lambda x: not x.lang)
if childs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if does not much, since if not childs, next call to write will iterate over a 0-length recordset and do nothing. Not a blocker, but I'd personally remove it.

Copy link

@susport susport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pedrobaeza pedrobaeza merged commit 6be6679 into OCA:8.0 Nov 24, 2016
@pedrobaeza pedrobaeza deleted the 8.0-partner_contact_lang branch November 24, 2016 22:52
pedrobaeza added a commit to Tecnativa/partner-contact that referenced this pull request Dec 6, 2016
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
cubells pushed a commit to Tecnativa/partner-contact that referenced this pull request Sep 12, 2017
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pedrobaeza added a commit to Tecnativa/partner-contact that referenced this pull request Sep 17, 2017
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
christophe-hanon pushed a commit to christophe-hanon/partner-contact that referenced this pull request Oct 2, 2018
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
cristinamartinrod pushed a commit to Tecnativa/partner-contact that referenced this pull request Oct 4, 2018
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pedrobaeza added a commit to Tecnativa/partner-contact that referenced this pull request Oct 10, 2018
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pegonzalezspesol pushed a commit to pegonzalezspesol/partner-contact that referenced this pull request Apr 5, 2020
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
yajo pushed a commit to Tecnativa/partner-contact that referenced this pull request Jun 26, 2020
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pedrobaeza added a commit to Tecnativa/partner-contact that referenced this pull request Jul 1, 2020
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
newtratip pushed a commit to ecosoft-odoo/partner-contact that referenced this pull request Oct 15, 2020
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pegonzalezspesol pushed a commit to pegonzalezspesol/partner-contact that referenced this pull request Dec 4, 2021
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pegonzalezspesol pushed a commit to pegonzalezspesol/partner-contact that referenced this pull request Jul 6, 2022
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pegonzalezspesol pushed a commit to pegonzalezspesol/partner-contact that referenced this pull request Oct 10, 2022
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
pegonzalezspesol pushed a commit to pegonzalezspesol/partner-contact that referenced this pull request Oct 10, 2022
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
victor-champonnois pushed a commit to coopiteasy/partner-contact that referenced this pull request Feb 3, 2023
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
edlopen pushed a commit to moduon/partner-contact that referenced this pull request Mar 1, 2024
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
edlopen pushed a commit to moduon/partner-contact that referenced this pull request Mar 1, 2024
===========================
Manage language in contacts
===========================

Odoo by default propagate language field to the created contacts from their
form, but it doesn't allow to change it once created.

This module fills this gap, and also provides other facilities for the
contact language management:

* Put the language of the parent company when the contact doesn't have a
  language and this parent company is assigned.
* When the company changes the language, it fills with the same language all
  the contacts that don't have any.

Usage
=====

Go to any partner that is a company and has contacts. Click on one contact
and you will be able to edit the language.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants