You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.4 KiB
38 lines
1.4 KiB
# Copyright 2016 Tecnativa - Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
|
# Copyright 2017 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
|
|
# Copyright 2018 Tecnativa - Cristina Martín
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo.tests import common
|
|
|
|
|
|
class TestPartnerContactLang(common.SavepointCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super(TestPartnerContactLang, cls).setUpClass()
|
|
cls.ResPartner = cls.env['res.partner']
|
|
cls.partner = cls.ResPartner.create({
|
|
'name': 'Partner test',
|
|
'lang': 'en_US',
|
|
})
|
|
cls.contact = cls.ResPartner.create({
|
|
'name': 'Contact test',
|
|
'lang': False,
|
|
'parent_id': cls.partner.id,
|
|
})
|
|
|
|
def test_onchange_parent_id(self):
|
|
self.contact.parent_id = False
|
|
res = self.contact.onchange_parent_id()
|
|
self.assertIsNone(res)
|
|
self.contact.parent_id = self.partner
|
|
res = self.contact.onchange_parent_id()
|
|
self.assertEqual(res.get('value', {}).get('lang'), 'en_US')
|
|
|
|
def test_write_parent_lang(self):
|
|
"""First empty the field for filling it again afterwards to see if
|
|
the contact gets the same value.
|
|
"""
|
|
self.partner.lang = False
|
|
self.partner.lang = 'en_US'
|
|
self.assertEqual(self.contact.lang, 'en_US')
|