-
-
Notifications
You must be signed in to change notification settings - Fork 857
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
Conversation
=========================== 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.
cc @Tecnativa |
|
||
@api.multi | ||
def write(self, vals): | ||
if 'lang' in vals and vals['lang']: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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).
There was a problem hiding this 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) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
=========================== 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.
=========================== 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.
=========================== 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.
=========================== 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.
=========================== 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.
=========================== 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.
=========================== 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.
=========================== 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.
=========================== 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:
language and this parent company is assigned.
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.