Browse Source

[MIG] partner_contact_lang: Migration to 9.0

14.0
Pedro M. Baeza 8 years ago
committed by newtratip
parent
commit
fed19ca48e
  1. 4
      partner_contact_lang/README.rst
  2. 4
      partner_contact_lang/__openerp__.py
  3. 5
      partner_contact_lang/models/res_partner.py
  4. 2
      partner_contact_lang/tests/test_partner_contact_lang.py
  5. 9
      partner_contact_lang/views/res_partner_view.xml

4
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.

4
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,
}

5
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', {})

2
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):

9
partner_contact_lang/views/res_partner_view.xml

@ -1,16 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="priority">9999</field>
<field name="arch" type="xml">
<!-- we have to replace it because it's not inside a group -->
<xpath expr="//field[@name='child_ids']/form//field[@name='lang']" position="replace"/>
<xpath expr="//field[@name='child_ids']/form//field[@name='mobile']" position="after">
<field name="lang"/>
</xpath>
</field>
</record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save