Commit 7f2a9584 authored by Aurel's avatar Aurel

choose which counter we want to open when opening counter date

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7113 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8efe02c7
No related merge requests found
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value> <string encoding="base64">bfINCg==</string> </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>from Products.ERP5Type.Document import newTempBase\n
\n
site = context.Baobab_getVaultSite(vault=context.getSiteValue())\n
counter_list = [x.getObject() for x in context.portal_catalog(portal_type="Counter", site_uid = site.getUid())]\n
\n
object_list = []\n
i = 0\n
for counter in counter_list:\n
line = newTempBase(context, \'tmp_open_%s\' %(str(i)))\n
line.edit(name=counter.getTitle(),\n
path = counter.getPath())\n
line.setUid(\'new_%s\' % counter.getPath())\n
object_list.append(line)\n
i += 1 \n
\n
return object_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_skins/erp5_banking_core/CounterDate_getSiteCounterList</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>_getattr_</string>
<string>context</string>
<string>site</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>counter_list</string>
<string>object_list</string>
<string>i</string>
<string>counter</string>
<string>str</string>
<string>line</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>CounterDate_getSiteCounterList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Workflow_statusModify</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>Default</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>Default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>my_workflow_action</string>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_choice</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CounterDate_viewOpenDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>CounterDate_viewOpenDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Open Counter Date</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -66,22 +66,12 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># put all counter in closing state for the given site\n
transaction = state_change.object\n
<value> <string>listbox = state_change.kwargs.get(\'listbox\')\n
\n
site = transaction.getSiteValue()\n
while True:\n
if not hasattr(site, \'getVaultTypeList\'):\n
msg = Message(domain = \'ui\', message = \'The site value is misconfigured; report this to system administrators.\')\n
raise ValidationFailed, (msg,)\n
if \'site\' in site.getVaultTypeList():\n
break\n
site = site.getParentValue()\n
\n
counter_list = [x.getObject() for x in context.portal_catalog(portal_type="Counter", simulation_state = \'closed\', site_uid = site.getUid())]\n
\n
for counter in counter_list:\n
counter.open()\n
for line in listbox:\n
if line["choice"] == "open":\n
counter = context.restrictedTraverse("%s" %(line[\'listbox_key\'],))\n
counter.open()\n
</string> </value>
</item>
<item>
......@@ -90,6 +80,12 @@ for counter in counter_list:\n
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/baobab/portal_workflow/accounting_date_workflow/scripts/openAllCounter</string> </value>
......@@ -132,19 +128,11 @@ for counter in counter_list:\n
<string>args</string>
<string>kw</string>
<string>_getattr_</string>
<string>transaction</string>
<string>site</string>
<string>True</string>
<string>hasattr</string>
<string>Message</string>
<string>msg</string>
<string>ValidationFailed</string>
<string>append</string>
<string>$append0</string>
<string>listbox</string>
<string>_getiter_</string>
<string>line</string>
<string>_getitem_</string>
<string>context</string>
<string>x</string>
<string>counter_list</string>
<string>counter</string>
</tuple>
</value>
......@@ -173,4 +161,25 @@ for counter in counter_list:\n
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/BaseWorkflow_viewWorkflowActionDialog?workflow_action=open_action</string> </value>
<value> <string>%(content_url)s/CounterDate_viewOpenDialog?workflow_action=open_action</string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
......
......@@ -69,33 +69,26 @@
<value> <string># check that every operation assigned to the counter are delivered\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
# XXX maybe raise other exception as otherwise the transition will passed even if\n
# check fail\n
\n
transaction = state_change.object\n
\n
site = transaction.Baobab_getVaultSite(vault=transaction.getSourceValue())\n
site = transaction.Baobab_getVaultSite(vault=transaction.getSiteValue())\n
\n
# get the current counter date\n
kwd = {\'portal_type\' : \'Accounting Date\', \'simulation_state\' : \'open\', \'site_uid\' : site.getUid()}\n
kwd = {\'portal_type\' : \'Counter Date\', \'simulation_state\' : \'open\', \'site_uid\' : site.getUid()}\n
date_list = [x.getObject() for x in context.portal_catalog(**kwd)]\n
current_date = None\n
if len(date_list) == 0:\n
msg = Message(domain = \'ui\', message = \'No Accounting Date found for this counter\')\n
msg = Message(domain = \'ui\', message = \'No Counter Date found for this counter\')\n
raise ValidationFailed, (msg,)\n
else:\n
current_date = date_list[0].getStartDate()\n
\n
site_uid = transaction.getSiteUid()\n
\n
# get all operations related to this counter\n
# # as source\n
# kwd_source = {\'source_uid\' : site_uid, \'delivery.start_date\' : current_date, \'simulation_state\' : \'confirmed\'}\n
# # as destination\n
# kwd_destination = {\'destination_uid\' : site_uid, \'delivery.start_date\' : current_date, \'simulation_state\' : \'confirmed\'}\n
# operation_list = list(context.portal_catalog(**kwd_source)) + list(context.portal_catalog(**kwd_destination))\n
# operation_list_object = [x.getObject() for x in operation_list]\n
\n
operation_list_object = transaction.Baobab_getRemainingOperationList(site_uid=site_uid, date=current_date, simulation_state=[\'confirmed\',])\n
\n
\n
context.log(\'counter_workflow, cancelRemainingOperation\', \'operation list = %s\' %(operation_list_object,))\n
\n
for operation in operation_list_object:\n
......
2006-05-8 aurel
* choose counter we want to open when opening counter date
2006-05-5 aurel
* clean up the skins
......
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