Commit cf1098ac authored by Lucas Carvalho's avatar Lucas Carvalho

If person has the same address than organisation, the subobject...

If person has the same address than organisation, the subobject (default_address) should not be created.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28959 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6626cd11
...@@ -780,6 +780,27 @@ class TestERP5Base(ERP5TypeTestCase): ...@@ -780,6 +780,27 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals(organisation.getDefaultAddressCity(),'Lille') self.assertEquals(organisation.getDefaultAddressCity(),'Lille')
self.assertEquals(organisation.getDefaultAddressZipCode(), '59000') self.assertEquals(organisation.getDefaultAddressZipCode(), '59000')
# if the address of the person is the same of the organisation
# there is no reason to create a subobject (default_address)
person.manage_delObjects(['default_address'])
person.edit(career_subordination_value=organisation)
self.assertTrue('default_address' not in person.objectIds())
self.assertEquals(person.getDefaultAddress(),
organisation.getDefaultAddress())
self.assertEquals(person.getDefaultAddressCity(),
organisation.getDefaultAddressCity())
self.assertEquals(person.getDefaultAddressZipCode(),
organisation.getDefaultAddressZipCode())
# if the address of the person is different then the subobject
# (default_address) must be created.
person.edit(default_address_city='La Garnache')
self.assertTrue('default_address' in person.objectIds())
self.assertNotEquals(person.getDefaultAddressCity(),
organisation.getDefaultAddressCity())
################################## ##################################
## Tests ## Tests
################################## ##################################
...@@ -1405,7 +1426,6 @@ class TestERP5Base(ERP5TypeTestCase): ...@@ -1405,7 +1426,6 @@ class TestERP5Base(ERP5TypeTestCase):
translated_portal_type='Personne')]) translated_portal_type='Personne')])
transaction.abort() transaction.abort()
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Base)) suite.addTest(unittest.makeSuite(TestERP5Base))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment