Commit d96f2be9 authored by Sebastien Robin's avatar Sebastien Robin

check if some objects already exists

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15226 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c784fcf1
...@@ -153,10 +153,10 @@ class BaobabConduit(ERP5Conduit): ...@@ -153,10 +153,10 @@ class BaobabConduit(ERP5Conduit):
'erp5_property': 'bank_account_number' 'erp5_property': 'bank_account_number'
, 'conditions' : {'erp5_portal_type':'Bank Account'} , 'conditions' : {'erp5_portal_type':'Bank Account'}
}], }],
'rib': [{ #'rib': [{
'erp5_property': 'bank_account_key' # 'erp5_property': 'bank_account_key'
, 'conditions' : {'erp5_portal_type':'Bank Account'} # , 'conditions' : {'erp5_portal_type':'Bank Account'}
}], # }],
'numero_interne': [{ 'numero_interne': [{
'erp5_property': 'internal_bank_account_number' 'erp5_property': 'internal_bank_account_number'
, 'conditions' : {'erp5_portal_type':'Bank Account'} , 'conditions' : {'erp5_portal_type':'Bank Account'}
...@@ -333,7 +333,7 @@ class BaobabConduit(ERP5Conduit): ...@@ -333,7 +333,7 @@ class BaobabConduit(ERP5Conduit):
object_id[:3]) object_id[:3])
subobject = organisation_module_object.newContent( portal_type = 'Organisation' subobject = organisation_module_object.newContent( portal_type = 'Organisation'
, id = object_id , id = object_id
, site = site_value.getRelativeUrl() , site = site_value.getRelativeUrl().replace('site/','')
) )
subobject.setRole('client') subobject.setRole('client')
...@@ -341,25 +341,29 @@ class BaobabConduit(ERP5Conduit): ...@@ -341,25 +341,29 @@ class BaobabConduit(ERP5Conduit):
elif portal_type.startswith('Compte'): elif portal_type.startswith('Compte'):
owner = findObjectFromSpecialPortalType(portal_type) owner = findObjectFromSpecialPortalType(portal_type)
if owner == None: return None if owner == None: return None
subobject = owner.newContent( portal_type = 'Bank Account' subobject = getattr(owner, object_id, None)
, id = object_id if subobject is None:
) subobject = owner.newContent( portal_type = 'Bank Account'
, id = object_id
)
# set the bank account owner as agent with no-limit privileges (only for persons) # set the bank account owner as agent with no-limit privileges (only for persons)
if owner.getPortalType() == 'Person': if owner.getPortalType() == 'Person':
new_agent = subobject.newContent( portal_type = 'Agent' new_agent = getattr(subobject, 'owner', None)
, id = 'owner' if new_agent is None:
) new_agent = subobject.newContent( portal_type = 'Agent'
, id = 'owner'
)
new_agent.setAgent(owner.getRelativeUrl()) new_agent.setAgent(owner.getRelativeUrl())
privileges = ( 'circularization' #privileges = ( 'circularization'
, 'cash_out' # , 'cash_out'
, 'withdrawal_and_payment' # , 'withdrawal_and_payment'
, 'account_document_view' # , 'account_document_view'
, 'signature' # , 'signature'
, 'treasury' # , 'treasury'
) # )
for privilege in privileges: #for privilege in privileges:
new_priv = new_agent.newContent(portal_type = 'Agent Privilege') # new_priv = new_agent.newContent(portal_type = 'Agent Privilege')
new_priv.setAgentPrivilege(privilege) # new_priv.setAgentPrivilege(privilege)
### handle agent objects ### handle agent objects
elif portal_type.startswith('Mandataire'): elif portal_type.startswith('Mandataire'):
...@@ -472,6 +476,7 @@ class BaobabConduit(ERP5Conduit): ...@@ -472,6 +476,7 @@ class BaobabConduit(ERP5Conduit):
if object == None: return if object == None: return
### Cash Inventory objects needs two properties to generate the vault path ### Cash Inventory objects needs two properties to generate the vault path
LOG('BaobabConduit.editDocument, object', 0, object)
if object.getPortalType() == 'Cash Inventory Group': if object.getPortalType() == 'Cash Inventory Group':
vault_path = self.getVaultPathFromCodification( object = object vault_path = self.getVaultPathFromCodification( object = object
, agency_code = kw['agency_code'] , agency_code = kw['agency_code']
...@@ -683,7 +688,7 @@ class BaobabConduit(ERP5Conduit): ...@@ -683,7 +688,7 @@ class BaobabConduit(ERP5Conduit):
# ) # )
if object.getPortalType() == 'Bank Account': if object.getPortalType() == 'Bank Account' and object.getValidationState()!='valid':
object.portal_workflow.doActionFor(object, 'validate_action', object.portal_workflow.doActionFor(object, 'validate_action',
wf_id='bank_account_workflow') wf_id='bank_account_workflow')
if object.getPortalType() == 'Person': if object.getPortalType() == 'Person':
...@@ -770,6 +775,11 @@ class BaobabConduit(ERP5Conduit): ...@@ -770,6 +775,11 @@ class BaobabConduit(ERP5Conduit):
# Convert compte_devise to price_currency # Convert compte_devise to price_currency
document.setPriceCurrency('currency_module/' + value) document.setPriceCurrency('currency_module/' + value)
def editCompteRib(self, document, value):
# Convert compte_devise to price_currency
value = '%02i' % int(value)
document.setBankAccountKey(value)
def editCompteOverdraftFacility(self, document, value): def editCompteOverdraftFacility(self, document, value):
new_value = False new_value = False
if value=='O': if value=='O':
......
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