def test_partner_onchange_city(self): """Test partner onchange city_id""" partner = Form(self.env["res.partner"]) partner.zip_id = self.lausanne self.city_bcn.country_id.enforce_cities = False partner.city_id = self.city_bcn self.assertFalse(partner.zip_id)
def test_onchange_city(self): """Check onchange city_id on partner and check if all the fields from main partner are changed.""" mainpartner_form = Form(self.mainpartner) # User change city of main partner mainpartner_form.city_id = self.city1 mainpartner_form.commune_id = self.commune2 mainpartner_form.city_id = self.city1 mainpartner_form.commune_id = self.commune1 mainpartner_form.city_id = self.city2 mainpartner_form.state_id = self.state1 mainpartner_form.city_id = self.city1 self.mainpartner = mainpartner_form.save() # Check main partner changed fields self.assertEqual(self.mainpartner.city, self.city1.name) self.assertEqual(self.mainpartner.commune_id.id, self.city1.commune_id.id) self.assertEqual(self.mainpartner.state_id.id, self.city1.state_id.id) self.assertEqual(self.mainpartner.zone_id.id, self.city1.zone_id.id) self.assertEqual(self.mainpartner.country_id.id, self.city1.country_id.id)