From 5dc6a30193b59bca6f86f556e2318d1ad25b2883 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 24 Nov 2016 23:52:04 +0100 Subject: [PATCH 1/3] partner_contact_lang: Manage language in contacts (#302) =========================== 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. --- partner_contact_lang/README.rst | 63 ++ partner_contact_lang/__init__.py | 4 + partner_contact_lang/__openerp__.py | 20 + partner_contact_lang/models/__init__.py | 4 + partner_contact_lang/models/res_partner.py | 42 + .../static/description/icon.png | Bin 0 -> 14414 bytes .../static/description/icon.svg | 760 ++++++++++++++++++ partner_contact_lang/tests/__init__.py | 4 + .../tests/test_partner_contact_lang.py | 29 + .../views/res_partner_view.xml | 16 + 10 files changed, 942 insertions(+) create mode 100644 partner_contact_lang/README.rst create mode 100644 partner_contact_lang/__init__.py create mode 100644 partner_contact_lang/__openerp__.py create mode 100644 partner_contact_lang/models/__init__.py create mode 100644 partner_contact_lang/models/res_partner.py create mode 100644 partner_contact_lang/static/description/icon.png create mode 100644 partner_contact_lang/static/description/icon.svg create mode 100644 partner_contact_lang/tests/__init__.py create mode 100644 partner_contact_lang/tests/test_partner_contact_lang.py create mode 100644 partner_contact_lang/views/res_partner_view.xml diff --git a/partner_contact_lang/README.rst b/partner_contact_lang/README.rst new file mode 100644 index 000000000..ecab7d3d5 --- /dev/null +++ b/partner_contact_lang/README.rst @@ -0,0 +1,63 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=========================== +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. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/134/8.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. 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 feedback. + +Credits +======= + +Contributors +------------ + +* Pedro M. Baeza + +Icon +---- +* Original Odoo icons. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/partner_contact_lang/__init__.py b/partner_contact_lang/__init__.py new file mode 100644 index 000000000..a77a6fcbc --- /dev/null +++ b/partner_contact_lang/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/partner_contact_lang/__openerp__.py b/partner_contact_lang/__openerp__.py new file mode 100644 index 000000000..6d154ab4d --- /dev/null +++ b/partner_contact_lang/__openerp__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# © 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Manage language in contacts', + 'version': '8.0.1.0.0', + 'category': 'Partner Management', + 'license': 'AGPL-3', + 'author': 'Tecnativa,' + 'Odoo Community Association (OCA)', + 'website': 'https://www.tecnativa.com', + 'depends': [ + 'base', + ], + 'data': [ + 'views/res_partner_view.xml', + ], + 'installable': True +} diff --git a/partner_contact_lang/models/__init__.py b/partner_contact_lang/models/__init__.py new file mode 100644 index 000000000..e0345afe7 --- /dev/null +++ b/partner_contact_lang/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_partner diff --git a/partner_contact_lang/models/res_partner.py b/partner_contact_lang/models/res_partner.py new file mode 100644 index 000000000..23d6e02f9 --- /dev/null +++ b/partner_contact_lang/models/res_partner.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# © 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import api, models + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + @api.multi + def write(self, vals): + """Propagate a language change in the partner to the child contacts.""" + res = super(ResPartner, self).write(vals) + if vals.get('lang'): + childs = self.search([ + ('id', 'child_of', self.ids), + ('lang', '=', False), + ]) + if childs: + childs.write({'lang': vals['lang']}) + return res + + @api.multi + def onchange_address(self, use_parent_address, parent_id): + """Change language if the parent company changes and there's no + language defined yet""" + res = super(ResPartner, self).onchange_address( + use_parent_address, parent_id) + if parent_id and self.parent_id.id != parent_id and not self.lang: + parent = self.browse(parent_id) + val = res.setdefault('value', {}) + val['lang'] = parent.lang + return res + + @api.multi + @api.onchange('lang') + def onchange_lang(self): + if self.lang: + childs = self.child_ids.filtered(lambda x: not x.lang) + for child in childs: + child.lang = self.lang diff --git a/partner_contact_lang/static/description/icon.png b/partner_contact_lang/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..90980f18432272ce0ec400c00f35bfeecf15f54b GIT binary patch literal 14414 zcmV-UII+ixP)Sb_q&rigr|Mr$Ft8qE40p5rQ}Ug_%K`k9Ed&(;50~NV4DM+9o`c$6NwH$ z4@L*VYs6S#wnj>7fF9$q=|0Gv9x}iO7^hC%5Ld3Pe#k;RUgpKel*%8IQl0{^1+Ze~ z42QXv1SX;$Od5b@whL?QUe~vE-*yBg-;|_!X5Jwpey>|SWPlGaCX;hgi0OF(K9lG9 zW24c^>9Q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0587yV*cjadw)AC)PJ|OI{wsnT;`dNe1$`o!b1ioAQB+q z;LH-j_lqrMIsiJ__RL79ccc@+iDe`}wCxd0t8^d)1HP-cUu}x3K@R~0D(}3MiA1k100b-?(d&$8{?|T zi%boA?)kvU(xyxHmGFxyB8Vf;C;=O!Hf_mQ9-?pq5j?c(;lyRIp~C_PoxAii92St$ zq3EDLLldaPW&WFRQ9Kg<{=zqk4E>`Jbh)!6+z~?T3vN1(ZgOl0pNw55}CmNM_3l2QM85$gWs3TDerbAK@jYi#3HUwQW4SQ8-l*H zTO$x70+A!02@=VBYAh4{aR5nDk&ED2;<}}thd)!^ZXGY>W_?7vQ{`gGl2%~ zZ1?$wz6Oe~xf9Oa5j6s7j*ECQz=U4gU+c8_$oBU3-AMr8DF8pI2$Tbe4wvu&B1cou zl>>7p`tsSM{UFFG9=A&Dt8i_kQdDy3Ll1XxLh4KVjt;1v*xA6do)CZu(keao(DO(> zVi?NB;9rX?=s&OY9m|IRFaDi|KMP11BqidzhUu}XRS@qYsTa@A!xg)2JqQUnhqp~< zDpM|qN{gp{8G7F~)Mr1tGkWEO7h?8_Ku!#}9h;unxq_4Ek8|xX zzCY+QKq12j-aHNWLBuN|fF*tDy5sqz{zBI?;rks7omsPX_BBdP^Ickmo;ozv$|9c`SQlV|F5mStyf7oA@IfAV?4 UY(&}0J^%m!07*qoM6N<$g7qn`qyPW_ literal 0 HcmV?d00001 diff --git a/partner_contact_lang/static/description/icon.svg b/partner_contact_lang/static/description/icon.svg new file mode 100644 index 000000000..95b972591 --- /dev/null +++ b/partner_contact_lang/static/description/icon.svg @@ -0,0 +1,760 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/partner_contact_lang/tests/__init__.py b/partner_contact_lang/tests/__init__.py new file mode 100644 index 000000000..410aa95b3 --- /dev/null +++ b/partner_contact_lang/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_partner_contact_lang diff --git a/partner_contact_lang/tests/test_partner_contact_lang.py b/partner_contact_lang/tests/test_partner_contact_lang.py new file mode 100644 index 000000000..273958854 --- /dev/null +++ b/partner_contact_lang/tests/test_partner_contact_lang.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# © 2016 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp.tests import common + + +class TestPartnerContactLang(common.TransactionCase): + def setUp(self): + super(TestPartnerContactLang, self).setUp() + self.ResPartner = self.env['res.partner'] + self.partner = self.ResPartner.create({ + 'name': 'Partner test', + 'lang': 'en_US', + }) + self.contact = self.ResPartner.create({ + 'name': 'Contact test', + 'lang': False, + 'parent_id': self.partner.id, + }) + + def test_onchange_parent_id(self): + self.contact.parent_id = False + res = self.contact.onchange_address(False, self.partner.id) + self.assertEqual(res.get('value', {}).get('lang'), 'en_US') + + def test_write_parent_lang(self): + self.partner.lang = 'en_US' + self.assertEqual(self.contact.lang, 'en_US') diff --git a/partner_contact_lang/views/res_partner_view.xml b/partner_contact_lang/views/res_partner_view.xml new file mode 100644 index 000000000..1213a38b9 --- /dev/null +++ b/partner_contact_lang/views/res_partner_view.xml @@ -0,0 +1,16 @@ + + + + + + res.partner + + + + + + + + + + From c5ce545f78e5b6e45831f6bdf77ad4d1597684a1 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Tue, 29 Nov 2016 08:31:02 -0500 Subject: [PATCH 2/3] OCA Transbot updated translations from Transifex --- partner_contact_lang/i18n/sl.po | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 partner_contact_lang/i18n/sl.po diff --git a/partner_contact_lang/i18n/sl.po b/partner_contact_lang/i18n/sl.po new file mode 100644 index 000000000..f922deb67 --- /dev/null +++ b/partner_contact_lang/i18n/sl.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_contact_lang +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-25 03:42+0000\n" +"PO-Revision-Date: 2016-11-25 03:42+0000\n" +"Last-Translator: Matjaž Mozetič , 2016\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: partner_contact_lang +#: model:ir.model,name:partner_contact_lang.model_res_partner +msgid "Partner" +msgstr "Partner" From 2e98b96d80d2c88730736dd12f7c5bd1ab60d85d Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 6 Dec 2016 14:42:58 +0100 Subject: [PATCH 3/3] [MIG] partner_contact_lang: Migration to 9.0 --- partner_contact_lang/README.rst | 4 ++-- partner_contact_lang/__openerp__.py | 4 ++-- partner_contact_lang/models/res_partner.py | 5 ++--- partner_contact_lang/tests/test_partner_contact_lang.py | 2 +- partner_contact_lang/views/res_partner_view.xml | 9 +++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/partner_contact_lang/README.rst b/partner_contact_lang/README.rst index ecab7d3d5..0522bafff 100644 --- a/partner_contact_lang/README.rst +++ b/partner_contact_lang/README.rst @@ -25,7 +25,7 @@ and you will be able to edit the language. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/8.0 + :target: https://runbot.odoo-community.org/runbot/134/9.0 Bug Tracker =========== @@ -52,7 +52,7 @@ Maintainer .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. diff --git a/partner_contact_lang/__openerp__.py b/partner_contact_lang/__openerp__.py index 6d154ab4d..6567618a4 100644 --- a/partner_contact_lang/__openerp__.py +++ b/partner_contact_lang/__openerp__.py @@ -4,7 +4,7 @@ { 'name': 'Manage language in contacts', - 'version': '8.0.1.0.0', + 'version': '9.0.1.0.0', 'category': 'Partner Management', 'license': 'AGPL-3', 'author': 'Tecnativa,' @@ -16,5 +16,5 @@ 'data': [ 'views/res_partner_view.xml', ], - 'installable': True + 'installable': True, } diff --git a/partner_contact_lang/models/res_partner.py b/partner_contact_lang/models/res_partner.py index 23d6e02f9..0b6b612c1 100644 --- a/partner_contact_lang/models/res_partner.py +++ b/partner_contact_lang/models/res_partner.py @@ -22,11 +22,10 @@ class ResPartner(models.Model): return res @api.multi - def onchange_address(self, use_parent_address, parent_id): + def onchange_parent_id(self, parent_id): """Change language if the parent company changes and there's no language defined yet""" - res = super(ResPartner, self).onchange_address( - use_parent_address, parent_id) + res = super(ResPartner, self).onchange_parent_id(parent_id) if parent_id and self.parent_id.id != parent_id and not self.lang: parent = self.browse(parent_id) val = res.setdefault('value', {}) diff --git a/partner_contact_lang/tests/test_partner_contact_lang.py b/partner_contact_lang/tests/test_partner_contact_lang.py index 273958854..945245198 100644 --- a/partner_contact_lang/tests/test_partner_contact_lang.py +++ b/partner_contact_lang/tests/test_partner_contact_lang.py @@ -21,7 +21,7 @@ class TestPartnerContactLang(common.TransactionCase): def test_onchange_parent_id(self): self.contact.parent_id = False - res = self.contact.onchange_address(False, self.partner.id) + res = self.contact.onchange_parent_id(self.partner.id) self.assertEqual(res.get('value', {}).get('lang'), 'en_US') def test_write_parent_lang(self): diff --git a/partner_contact_lang/views/res_partner_view.xml b/partner_contact_lang/views/res_partner_view.xml index 1213a38b9..4412c82af 100644 --- a/partner_contact_lang/views/res_partner_view.xml +++ b/partner_contact_lang/views/res_partner_view.xml @@ -1,16 +1,17 @@ - - + res.partner + 9999 + + - - +