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.

29 lines
990 B

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp.tests import common
  5. class TestPartnerContactLang(common.TransactionCase):
  6. def setUp(self):
  7. super(TestPartnerContactLang, self).setUp()
  8. self.ResPartner = self.env['res.partner']
  9. self.partner = self.ResPartner.create({
  10. 'name': 'Partner test',
  11. 'lang': 'en_US',
  12. })
  13. self.contact = self.ResPartner.create({
  14. 'name': 'Contact test',
  15. 'lang': False,
  16. 'parent_id': self.partner.id,
  17. })
  18. def test_onchange_parent_id(self):
  19. self.contact.parent_id = False
  20. res = self.contact.onchange_parent_id(self.partner.id)
  21. self.assertEqual(res.get('value', {}).get('lang'), 'en_US')
  22. def test_write_parent_lang(self):
  23. self.partner.lang = 'en_US'
  24. self.assertEqual(self.contact.lang, 'en_US')