Commit 456ab1c3 authored by Kevin Deldycke's avatar Kevin Deldycke

Basic support of Cash Inventory


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3205 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eaad40ed
......@@ -99,10 +99,12 @@ class BaobabConduit(ERP5Conduit):
, 'erp5_property': 'bic_code'
, 'conditions' : {'erp5_portal_type':'Organisation'}
}
, { 'xml_property' : 'intitule'
, 'erp5_property': 'title'
, 'conditions' : {'erp5_portal_type':'Bank Account'}
}
, { 'xml_property' : 'montant_maxi'
, 'erp5_property': 'operation_upper_limit'
, 'conditions' : {'erp5_portal_type':'Agent Privilege'}
......@@ -111,6 +113,11 @@ class BaobabConduit(ERP5Conduit):
, 'erp5_property': 'description'
, 'conditions' : {'erp5_portal_type':'Agent Privilege'}
}
, { 'xml_property' : 'inventory_title'
, 'erp5_property': 'title'
, 'conditions' : {'erp5_portal_type':'Cash Inventory'}
}
]
"""
......@@ -150,8 +157,9 @@ class BaobabConduit(ERP5Conduit):
This is a redefinition of the original ERP5Conduit.constructContent function to create Baobab objects
"""
erp5_site_path = object.absolute_url(relative=1)
person_folder = object.restrictedTraverse(erp5_site_path + '/person')
organisation_folder = object.restrictedTraverse(erp5_site_path + '/organisation')
person_module = object.restrictedTraverse(erp5_site_path + '/person')
organisation_module = object.restrictedTraverse(erp5_site_path + '/organisation')
cash_inventory_module = object.restrictedTraverse(erp5_site_path + '/cash_inventory_module')
subobject = None
......@@ -176,12 +184,14 @@ class BaobabConduit(ERP5Conduit):
# handle client objects
if portal_type.startswith('Client'):
if portal_type[-3:] == 'PER':
subobject = person_folder.newContent( portal_type = 'Person'
, id = object_id)
subobject = person_module.newContent( portal_type = 'Person'
, id = object_id
)
subobject.setCareerRole('client')
else:
subobject = organisation_folder.newContent( portal_type = 'Organisation'
, id = object_id)
subobject = organisation_module.newContent( portal_type = 'Organisation'
, id = object_id
)
subobject.setRole('client')
# handle bank account objects
......@@ -189,11 +199,13 @@ class BaobabConduit(ERP5Conduit):
owner = findObjectFromSpecialPortalType(portal_type)
if owner == None: return None
subobject = owner.newContent( portal_type = 'Bank Account'
, id = object_id)
, id = object_id
)
# set the bank account owner as agent with no-limit privileges (only for persons)
if owner.getPortalType() == 'Person':
new_agent = subobject.newContent( portal_type = 'Agent'
, id = 'owner')
, id = 'owner'
)
new_agent.setAgent(owner.getRelativeUrl())
privileges = ( 'circularization'
, 'cash_out'
......@@ -211,12 +223,14 @@ class BaobabConduit(ERP5Conduit):
dest = findObjectFromSpecialPortalType(portal_type)
if dest == None: return None
subobject = dest.newContent( portal_type = 'Agent'
, id = object_id)
, id = object_id
)
# try to get the agent in the person module
person = findObjectFromSpecialPortalType('Person_' + object_id)
if person == None:
person = person_folder.newContent( portal_type = 'Person'
, id = object_id + 'a')
person = person_module.newContent( portal_type = 'Person'
, id = object_id + 'a'
)
subobject.setAgent(person.getRelativeUrl())
# handle privilege objects
......@@ -224,13 +238,27 @@ class BaobabConduit(ERP5Conduit):
dest = findObjectFromSpecialPortalType(portal_type)
if dest == None: return None
subobject = dest.newContent( portal_type = 'Agent Privilege'
, id = object_id)
, id = object_id
)
# handle inventory objects
elif portal_type == 'Cash Inventory':
if cash_inventory_module == None: return None
subobject = cash_inventory_module.newContent( portal_type = 'Cash Inventory'
, id = object_id
)
# handle inventory details objects
elif portal_type == 'Cash Inventory Detail':
subobject = object.newContent( portal_type = 'Cash Inventory Line'
, id = object_id
)
return subobject
# EXPERIMENTAL
### EXPERIMENTAL
# security.declareProtected(Permissions.ModifyPortalContent, 'getProperty')
# def getProperty(self, object, kw):
# """
......@@ -259,7 +287,7 @@ class BaobabConduit(ERP5Conduit):
This function transfer datas from the dictionary to the baobab document object given in parameters
"""
# EXPERIMENTAL
### EXPERIMENTAL
# This message help to track in the log when an object is edited
# It permit us to verify the consistency of a synchronisation process :
# 1- Launch a normal synchronisation.
......@@ -394,7 +422,8 @@ class BaobabConduit(ERP5Conduit):
def editMandataireService(self, document, value):
assignment = document.getAgentValue().newContent( portal_type = 'Assignment'
, id = 'service')
, id = 'service'
)
assignment.setGroup(value)
return
......@@ -437,3 +466,18 @@ class BaobabConduit(ERP5Conduit):
if document.getStartDate() in ('', None):
document.setStartDate(str(datetime.datetime.min))
document.setStopDate(value)
# CashInventory-related-properties functions
def editCashInventoryInventoryDate(self, document, value):
if value in ('', None):
date = str(datetime.datetime.max)
else:
# Convert french date to strandard date
date_items = value.split('/')
day = date_items[0]
month = date_items[1]
year = date_items[2]
date = '/'.join([year, month, day])
document.setStopDate(date)
\ 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