Commit 101a6a8b authored by Kevin Deldycke's avatar Kevin Deldycke

Update person and organisation module id


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4524 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5c50daf8
...@@ -165,8 +165,8 @@ class BaobabConduit(ERP5Conduit): ...@@ -165,8 +165,8 @@ class BaobabConduit(ERP5Conduit):
create Baobab objects. create Baobab objects.
""" """
erp5_site_path = object.absolute_url(relative=1) erp5_site_path = object.absolute_url(relative=1)
person_module = object.person person_module_object = object.person_module
organisation_module = object.organisation organisation_module_object = object.organisation_module
# Modules below are not always required # Modules below are not always required
# (it depends of the nature of objects you want to synchronize) # (it depends of the nature of objects you want to synchronize)
...@@ -186,7 +186,7 @@ class BaobabConduit(ERP5Conduit): ...@@ -186,7 +186,7 @@ class BaobabConduit(ERP5Conduit):
source_portal_type = special_portal_type.split('_')[0] source_portal_type = special_portal_type.split('_')[0]
construction_location = '/'.join(special_portal_type.split('_')[1:][::-1]) construction_location = '/'.join(special_portal_type.split('_')[1:][::-1])
parent_object = None parent_object = None
for search_folder in ('person', 'organisation'): for search_folder in ('person_module', 'organisation_module'):
path = '/' + search_folder + '/' + construction_location path = '/' + search_folder + '/' + construction_location
parent_object_path = erp5_site_path + path parent_object_path = erp5_site_path + path
try: try:
...@@ -213,12 +213,12 @@ class BaobabConduit(ERP5Conduit): ...@@ -213,12 +213,12 @@ class BaobabConduit(ERP5Conduit):
### handle client objects ### handle client objects
if portal_type.startswith('Client'): if portal_type.startswith('Client'):
if portal_type[-3:] == 'PER': if portal_type[-3:] == 'PER':
subobject = person_module.newContent( portal_type = 'Person' subobject = person_module_object.newContent( portal_type = 'Person'
, id = object_id , id = object_id
) )
subobject.setCareerRole('client') subobject.setCareerRole('client')
else: else:
subobject = organisation_module.newContent( portal_type = 'Organisation' subobject = organisation_module_object.newContent( portal_type = 'Organisation'
, id = object_id , id = object_id
) )
subobject.setRole('client') subobject.setRole('client')
...@@ -257,7 +257,7 @@ class BaobabConduit(ERP5Conduit): ...@@ -257,7 +257,7 @@ class BaobabConduit(ERP5Conduit):
# try to get the agent in the person module # try to get the agent in the person module
person = findObjectFromSpecialPortalType('Person_' + object_id) person = findObjectFromSpecialPortalType('Person_' + object_id)
if person == None: if person == None:
person = person_module.newContent( portal_type = 'Person' person = person_module_object.newContent( portal_type = 'Person'
, id = object_id + 'a' , id = object_id + 'a'
) )
subobject.setAgent(person.getRelativeUrl()) subobject.setAgent(person.getRelativeUrl())
...@@ -460,8 +460,8 @@ class BaobabConduit(ERP5Conduit): ...@@ -460,8 +460,8 @@ class BaobabConduit(ERP5Conduit):
if k == 'account_number': bank_account_number = v if k == 'account_number': bank_account_number = v
# try to find the bank account # try to find the bank account
if bank_account_number != None: if bank_account_number != None:
customer_list = object.person.contentValues(filter={'portal_type': 'Person'}) + \ customer_list = object.person_module.contentValues(filter={'portal_type': 'Person'}) + \
object.organisation.contentValues(filter={'portal_type': 'Organisation'}) object.organisation_module.contentValues(filter={'portal_type': 'Organisation'})
bank_account_object = None bank_account_object = None
for customer in customer_list: for customer in customer_list:
for bank_account in customer.contentValues(filter={'portal_type': 'Bank Account'}): for bank_account in customer.contentValues(filter={'portal_type': 'Bank Account'}):
......
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