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.

28 lines
1023 B

  1. # Copyright 2017 Onestein (<http://www.onestein.eu>)
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo.tests.common import TransactionCase
  4. class TestOnchangeHelper(TransactionCase):
  5. def test01_partner_parent(self):
  6. main_partner = self.env.ref('base.main_partner')
  7. input_vals = dict(partner_id=main_partner.id)
  8. updated_vals = self.env['res.partner'].play_onchanges(
  9. input_vals,
  10. ['parent_id']
  11. )
  12. self.assertIn('commercial_partner_id', updated_vals)
  13. self.assertIn('display_name', updated_vals)
  14. self.assertIn('partner_id', updated_vals)
  15. def test02_partner_country(self):
  16. partner_demo = self.env.ref('base.partner_demo')
  17. input_vals = {'partner_id': partner_demo.id}
  18. updated_vals = self.env['res.partner'].play_onchanges(
  19. input_vals,
  20. ['country_id']
  21. )
  22. self.assertIn('contact_address', updated_vals)
  23. self.assertIn('partner_id', updated_vals)