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.

26 lines
975 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 Akretion (http://www.akretion.com).
  3. # @author Sébastien BEAU <sebastien.beau@akretion.com>
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  5. import openerp.tests.common as common
  6. class TestOnchange(common.TransactionCase):
  7. def test_playing_onchange_on_model(self):
  8. result = self.env['res.partner'].play_onchanges({
  9. 'company_type': 'company',
  10. }, ['company_type'])
  11. self.assertEqual(result['is_company'], True)
  12. def test_playing_onchange_on_record(self):
  13. company = self.env.ref('base.main_company')
  14. result = company.play_onchanges({
  15. 'email': 'contact@akretion.com'},
  16. ['email'])
  17. self.assertEqual(
  18. result['rml_footer'],
  19. u'Phone: +1 555 123 8069 | Email: contact@akretion.com | '
  20. u'Website: http://www.example.com')
  21. self.assertEqual(company.email, u'info@yourcompany.example.com')