Commit ad285f86 authored by Thibaut Deheunynck's avatar Thibaut Deheunynck

thibaut.

Change createOrganisationFromM0 because all organisation must have one corporate registration code. But we can find the head office, the second company or branch thanks to source reference.
So I modify several scripts to respect this change.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22885 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24e5108c
......@@ -67,9 +67,9 @@
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
current_object = context.getObject()\n
rccm = current_object.getCorporateRegistrationCode()\n
rccm = current_object.getSourceReference()\n
org_list = []\n
org_result = portal.organisation_module.searchFolder(corporate_registration_code=rccm)\n
org_result = portal.organisation_module.searchFolder(source_reference=rccm)\n
org_list = [org.getObject() for org in org_result if org.getObject() != context.getObject()]\n
return org_list\n
</string> </value>
......
......@@ -67,11 +67,8 @@
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
current_object = context.getObject()\n
rccm = current_object.getCorporateRegistrationCode()\n
pers_list = []\n
pers_result = portal.person_module.searchFolder(corporate_registration_code=rccm)\n
pers_list = [pers.getObject() for pers in pers_result]\n
return org_list\n
person_list = [assignment.getParentValue() for assignment in current_object.getDestinationRelatedValueList()]\n
return pers_list\n
</string> </value>
</item>
<item>
......@@ -119,14 +116,12 @@ return org_list\n
<string>context</string>
<string>portal</string>
<string>current_object</string>
<string>rccm</string>
<string>pers_list</string>
<string>pers_result</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>pers</string>
<string>org_list</string>
<string>assignment</string>
<string>person_list</string>
<string>pers_list</string>
</tuple>
</value>
</item>
......
......@@ -80,7 +80,7 @@ for assignment in assignment_list:\n
raise ValidationFailed, \'There is no Person corresponding to the corporate registration code %s\' % rccm\n
person = pers_result[0].getObject()\n
legal_form = person.getSocialForm()\n
if assignment.getFunction()==\'corporation/shareholder\' :\n
if assignment.getFunction()==\'entreprise/associe\' :\n
if legal_form == \'gie\':\n
assignment.getFunctionValue().setTitle(\'Membre du GIE\')\n
elif legal_form == \'sarl\':\n
......
......@@ -66,10 +66,11 @@
<item>
<key> <string>_body</string> </key>
<value> <string>current_object = context.getObject()\n
assgt_list=current_object.contentValues(filter={\'portal_type\': \'Assignment\',\'function\':\'merchant\',})\n
assignment_list = [assignment for assignment in current_object.contentValues(portal_type = \'Assignment\') \\\n
if assignment.getFunction() == \'commerce/commercant\']\n
exploited_org_list = []\n
for assgt in assgt_list:\n
exploited_org_list.append(assgt.getDestinationValue())\n
for assignment in assignment_list:\n
exploited_org_list.append(assignment.getDestinationValue())\n
return exploited_org_list\n
</string> </value>
</item>
......@@ -117,10 +118,12 @@ return exploited_org_list\n
<string>_getattr_</string>
<string>context</string>
<string>current_object</string>
<string>assgt_list</string>
<string>exploited_org_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>assgt</string>
<string>assignment</string>
<string>assignment_list</string>
<string>exploited_org_list</string>
</tuple>
</value>
</item>
......
......@@ -94,7 +94,6 @@ organisation.edit(\n
corporate_name=request_eform.getName(),\n
acronym=request_eform.getInitials(),\n
sign=request_eform.getSign(),\n
default_address_street_address=request_eform.getWorkAddress(),\n
default_address_city=request_eform.getDefaultAddressCity(),\n
social_form=\'%s\' % request_eform.getLegalForm().lower(),\n
price_currency=\'currency_module/1\', # object 1 is the devise XOF\n
......@@ -171,25 +170,26 @@ for assignment in assignment_list:\n
if request_eform.getMoralPerson():\n
organisation.edit(role=\'entreprise/siege\',\n
corporate_registration_code=new_registry_number,\n
source_reference=new_registry_number,\n
default_address_street_address=request_eform.getHeadOfficeAddress(),\n
geographic_incorporate_code =\'-\'.join(str(new_registry_number).split(\'-\')[0:2]))\n
request_eform.edit(corporate_registration_code = new_registry_number)\n
elif request_eform.getBranch():\n
organisation_list = [organisation.getObject() for organisation in\\\n
organisation_module.searchFolder(corporate_registration_code=request_eform.getCorporateRegistrationCode())]\n
for org in organisation_list:\n
organisation.edit(succursale_value = organisation,\n
role=\'entreprise/succursale\')\n
request_eform.edit(succursale_value = organisation)\n
organisation.edit(role=\'entreprise/succursale\',\n
default_address_street_address=request_eform.getFirstCompanyAddress(),\n
corporate_registration_code = new_registry_number,\n
source_reference=request_eform.getCorporateRegistrationCode())\n
elif request_eform.getSecondCompany():\n
organisation_list = [organisation.getObject() for organisation in \\\n
organisation_module.searchFolder(corporate_registration_code=request_eform.getCorporateRegistrationCode())]\n
for org in organisation_list:\n
organisation.edit(agence_value = organisation,\n
role = \'entreprise/agence\')\n
request_eform.edit(agence_value = organisation)\n
organisation.edit(role = \'entreprise/agence\',\n
default_address_street_address=request_eform.getWorkAddress(),\n
corporate_registration_code = new_registry_number,\n
source_reference=request_eform.getCorporateRegistrationCode(),\n
)\n
else:\n
organisation.edit(role = \'entreprise/siege\',\n
corporate_registration_code = request_eform.getCorporateRegistrationCode(),\n
source_reference = request_eform.getCorporateRegistrationCode(),\n
default_address_street_address=request_eform.getWorkAddress(),\n
description = "Harmonisation d\'une personne morale")\n
\n
#Activate Organisation and update security\n
......@@ -308,8 +308,6 @@ for M0_bis in M0_bis_list:\n
<string>assignment</string>
<string>assignment_list</string>
<string>str</string>
<string>organisation_list</string>
<string>org</string>
<string>history_list</string>
<string>history</string>
<string>M0_bis</string>
......
833
\ No newline at end of file
845
\ No newline at end of file
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