Commit a71e4832 authored by Aurel's avatar Aurel

change way to retrieve an organisation for a site

add new script to get agency for a given site

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19012 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f921c8d4
......@@ -65,10 +65,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>organisation_list = [x.getObject() for x in context.portal_catalog(portal_type=\'Organisation\', site_uid=site.getUid()) if x.getObject().getRole()==\'internal\']\n
if len(organisation_list) != 1:\n
raise ValueError, \'Must not get %d organisation for the site %s\' %(len(organisation_list),site.getTitle())\n
organisation = organisation_list[0]\n
<value> <string>if isinstance(site, str):\n
site = context.portal_categories.site.restrictedTraverse(site)\n
orga_id = "site_%3s" %(site.getCodification())\n
organisation = context.organisation_module[orga_id]\n
\n
account_list = [x for x in organisation.objectValues(portal_type=\'Bank Account\') if x.getValidationState() == \'valid\']\n
if len(account_list)!=1:\n
raise ValueError, \'Must not get %d account for the organisation %s\' %(len(account_list),organisation.getTitle())\n
......@@ -122,18 +123,20 @@ return account_list[0]\n
<value>
<tuple>
<string>site</string>
<string>isinstance</string>
<string>str</string>
<string>_getattr_</string>
<string>context</string>
<string>orga_id</string>
<string>_getitem_</string>
<string>organisation</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>x</string>
<string>organisation_list</string>
<string>account_list</string>
<string>len</string>
<string>ValueError</string>
<string>_getitem_</string>
<string>organisation</string>
<string>account_list</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if isinstance(site, str):\n
site = context.portal_categories.site.restrictedTraverse(site)\n
\n
orga_id = "site_%3s" %(site.getCodification())\n
org = context.organisation_module[orga_id]\n
\n
return org\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>site</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>site</string>
<string>isinstance</string>
<string>str</string>
<string>_getattr_</string>
<string>context</string>
<string>orga_id</string>
<string>_getitem_</string>
<string>org</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Baobab_getAgencyForSite</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -67,6 +67,7 @@
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
node = context.REQUEST.form[\'vault\']\n
\n
container_portal_type_list = ["Monetary Reception",]\n
\n
base_price_dict = {}\n
......
412
\ No newline at end of file
414
\ 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