Commit acf90249 authored by Aurel's avatar Aurel

add a report for cash container

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18991 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8cd0338e
......@@ -23,7 +23,7 @@
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_print</string> </value>
<value> <string>object_report</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -39,7 +39,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>print_pdf</string> </value>
<value> <string>container_report</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
......@@ -51,11 +51,11 @@
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>60.0</float> </value>
<value> <float>4.5</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Print</string> </value>
<value> <string>Container Report</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -75,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_printPdf</string> </value>
<value> <string>string:${object_url}/CounterModule_viewContainerReportDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -70,8 +70,9 @@ from Products.ERP5Type.Message import Message\n
\n
object_to_check_list = [context]\n
object_to_check_list.extend(context.getMovementList())\n
\n
context.log("object to check", object_to_check_list)\n
for object in object_to_check_list:\n
context.log("object", object)\n
baobab_source = object.getBaobabSource()\n
baobab_destination = object.getBaobabDestination()\n
\n
......
<?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>from DateTime import DateTime\n
node = context.REQUEST.form[\'vault\']\n
container_portal_type_list = ["Monetary Reception",]\n
\n
base_price_dict = {}\n
\n
if listbox is None:\n
\n
# node = context.getSource()\n
reference_date = DateTime()\n
container_list = []\n
listbox = []\n
#context.log("tracking list", context.portal_simulation.getCurrentTrackingList(at_date= reference_date, node = node))\n
resource_translated_title_dict = {}\n
total_price_dict = {}\n
listbox_append = listbox.append\n
for o in context.portal_simulation.getCurrentTrackingList(at_date= reference_date, node = node):\n
cash_container = o.getObject()\n
\n
if cash_container.getParentValue().getPortalType() in container_portal_type_list:\n
# get one line in order to know some properties of the cash container\n
container_dict = {}\n
container_lines = cash_container.objectValues(portal_type=\'Container Line\')\n
if len(container_lines) == 0:\n
context.log("MonetaryIssue_generateCashContainerInputDialog", "No container line find for cash container %s" %(cash_container.getRelativeUrl(),))\n
continue\n
container_line = container_lines[0]\n
container_dict[\'reference\'] = cash_container.getReference()\n
container_dict[\'cash_number_range_start\'] = cash_container.getCashNumberRangeStart()\n
container_dict[\'cash_number_range_stop\'] = cash_container.getCashNumberRangeStop()\n
\n
resource = container_line.getResource()\n
base_price = base_price_dict.get(resource, None)\n
if base_price is None:\n
base_price = container_line.getResourceValue().getBasePrice()\n
base_price_dict[resource] = base_price\n
container_dict[\'base_price\'] = base_price\n
resource_translated_title = resource_translated_title_dict.get(resource, None)\n
if resource_translated_title is None:\n
resource_translated_title = container_line.getResourceTranslatedTitle()\n
resource_translated_title_dict[resource] = resource_translated_title\n
container_dict[\'resource_translated_title\'] = resource_translated_title\n
quantity = container_line.getQuantity()\n
container_dict[\'quantity\'] = quantity\n
total_price = total_price_dict.get((quantity,resource), None)\n
if total_price is None:\n
total_price = container_line.getTotalPrice(fast=0)\n
total_price_dict[(quantity,resource)] = total_price\n
container_dict[\'total_price\'] = total_price\n
container_dict[\'selection\'] = 0\n
container_dict[\'date\'] = o.date\n
container_dict[\'uid\'] = \'new_%s\' %(cash_container.getUid(),) #cash_container.getReference().replace(\'/\', \'_\'),)\n
\n
listbox_append(container_dict)\n
\n
def sortListbox(a, b):\n
result = cmp(a["date"], b["date"])\n
if result == 0:\n
result = cmp(a["base_price"], b["base_price"])\n
if result == 0:\n
result = cmp(a["reference"], b["reference"])\n
\n
return result\n
\n
listbox.sort(sortListbox)\n
\n
context.Base_updateDialogForm(listbox=listbox\n
)\n
\n
return context.asContext(context=None\n
, portal_type=context.getPortalType()\n
).CounterModule_viewContainerReportForm(**kw)\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>listbox=None, cash_detail_dict=None, **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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>listbox</string>
<string>cash_detail_dict</string>
<string>kw</string>
<string>DateTime</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>node</string>
<string>container_portal_type_list</string>
<string>base_price_dict</string>
<string>None</string>
<string>reference_date</string>
<string>container_list</string>
<string>resource_translated_title_dict</string>
<string>total_price_dict</string>
<string>listbox_append</string>
<string>_getiter_</string>
<string>o</string>
<string>cash_container</string>
<string>container_dict</string>
<string>container_lines</string>
<string>len</string>
<string>container_line</string>
<string>_write_</string>
<string>resource</string>
<string>base_price</string>
<string>resource_translated_title</string>
<string>quantity</string>
<string>total_price</string>
<string>sortListbox</string>
<string>_apply_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CounterModule_callContainerReportDialog</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>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</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>CounterModule_callContainerReportDialog</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>None</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_vault</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CounterModule_viewContainerReportDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>CounterModule_viewReportDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_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>Report</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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</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></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>None</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>left</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>bottom</string> </key>
<value>
<list>
<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_quantity</string>
<string>listbox_total_price</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CounterModule_viewContainerReportForm</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>CounterModule_viewContainerReportForm</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_list</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>Containers</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>
407
\ No newline at end of file
412
\ No newline at end of file
......@@ -43,7 +43,7 @@ Counter Date Module | view
Counter Date | counter_stock
Counter Date | remaining_operations
Counter Date | view
Counter Module | print_pdf
Counter Module | container_report
Counter Module | vault_report
Counter Module | view
Counter | view
......
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