from odoo.tests.common import TransactionCase from odoo.tests.form import Form class MyTest(TransactionCase): def test_form(self): # Create a Form view with Form(res_model='res.partner') as f: f.name = 'John Doe' f.email = '[email protected]' # Test the values self.assertEqual(f.name, 'John Doe') self.assertEqual(f.email, '[email protected]')
from odoo.tests.common import TransactionCase from odoo.tests.form import Form class MyTest(TransactionCase): def test_form(self): # Create a Form view with Form(env=self.env, model_name='res.partner') as f: f.name = 'Jane Doe' f.email = '[email protected]' # Save the record using the Form view partner = f.save() # Test the record fields self.assertEqual(partner.name, 'Jane Doe') self.assertEqual(partner.email, '[email protected]')In this example, we create a Form view for the 'res.partner' model and save the record using the Form view. Overall, the odoo.tests Form Form package library is used for testing the Form view in Odoo and is part of the Odoo testing framework.