Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ekaterina
erp5
Commits
c9cea662
Commit
c9cea662
authored
Jul 07, 2015
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
invoicing & order report : run it with searchAndActivate to manage big databases
parent
04cc454b
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
886 additions
and
652 deletions
+886
-652
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_getInvoiceReport.xml
...nvoicing/AccountingTransactionModule_getInvoiceReport.xml
+70
-0
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_viewInvoiceReportDialog.xml
...g/AccountingTransactionModule_viewInvoiceReportDialog.xml
+6
-4
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_viewInvoiceReportDialog/your_deferred_style.xml
...ionModule_viewInvoiceReportDialog/your_deferred_style.xml
+0
-90
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_viewInvoiceReportDialog/your_use_selection.xml
...tionModule_viewInvoiceReportDialog/your_use_selection.xml
+0
-168
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_activateGetOrderStatList.xml
...skins/erp5_trade/OrderModule_activateGetOrderStatList.xml
+167
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_filterOrderStatResul.xml
...tal_skins/erp5_trade/OrderModule_filterOrderStatResul.xml
+69
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReport.xml
...em/portal_skins/erp5_trade/OrderModule_getOrderReport.xml
+70
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.xml
...ns/erp5_trade/OrderModule_getOrderReportParameterDict.xml
+159
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportSectionList.xml
...kins/erp5_trade/OrderModule_getOrderReportSectionList.xml
+2
-91
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.xml
.../portal_skins/erp5_trade/OrderModule_getOrderStatList.xml
+53
-115
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_launchOrderReport.xml
...portal_skins/erp5_trade/OrderModule_launchOrderReport.xml
+128
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_processOrderStat.xml
.../portal_skins/erp5_trade/OrderModule_processOrderStat.xml
+156
-0
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml
...al_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml
+6
-4
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_deferred_style.xml
...OrderModule_viewOrderReportDialog/your_deferred_style.xml
+0
-90
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_use_selection.xml
.../OrderModule_viewOrderReportDialog/your_use_selection.xml
+0
-90
No files found.
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_getInvoiceReport.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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>
return context.OrderModule_launchOrderReport(\n
report_method_id = "AccountingTransactionModule_viewInvoiceReport",\n
*args,\n
**kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingTransactionModule_getInvoiceReport
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_viewInvoiceReportDialog.xml
View file @
c9cea662
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5
Form"
module=
"Products.ERP5Form.Form
"
/>
<global
name=
"ERP5
Form"
module=
"erp5.portal_type
"
/>
</pickle>
<pickle>
<dictionary>
...
...
@@ -35,7 +35,7 @@
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
AccountingTransactionModule_
view
InvoiceReport
</string>
</value>
<value>
<string>
AccountingTransactionModule_
get
InvoiceReport
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -83,7 +83,6 @@
<list>
<string>
your_portal_skin
</string>
<string>
your_format
</string>
<string>
your_deferred_style
</string>
</list>
</value>
</item>
...
...
@@ -104,7 +103,6 @@
<string>
your_incoterm
</string>
<string>
your_order_report_document_portal_type
</string>
<string>
your_landscape
</string>
<string>
your_use_selection
</string>
</list>
</value>
</item>
...
...
@@ -157,6 +155,10 @@
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
...
...
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_viewInvoiceReportDialog/your_deferred_style.xml
deleted
100644 → 0
View file @
04cc454b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_deferred_style
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
your_deferred_style
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewDialogFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/AccountingTransactionModule_viewInvoiceReportDialog/your_use_selection.xml
deleted
100644 → 0
View file @
04cc454b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"CheckBoxField"
module=
"Products.Formulator.StandardFields"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_use_selection
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Use Current Selection
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_activateGetOrderStatList.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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.ZSQLCatalog.SQLCatalog import Query\n
\n
portal = context.getPortalObject()\n
category_tool = portal.portal_categories\n
\n
request = container.REQUEST\n
from_date = request.get(\'from_date\', None)\n
to_date = request.get(\'at_date\', None)\n
aggregation_level = request.get(\'aggregation_level\', None)\n
report_group_by = request.get(\'group_by\', None)\n
# get all category\n
incoterm = request.get(\'incoterm\', None)\n
section_category = request.get(\'section_category\', None)\n
order = request.get(\'order\', None)\n
delivery_mode = request.get(\'delivery_mode\', None)\n
\n
catalog_params = {}\n
line_params = {"portal_type" : line_portal_type}\n
# get all organisations for the selected section category\n
if section_category:\n
group_uid = category_tool.getCategoryValue(section_category).getUid()\n
organisation_uid_list = [x.uid for x in portal.portal_catalog(\n
portal_type="Organisation",\n
default_group_uid=group_uid)]\n
if report_type == "sale":\n
catalog_params[\'default_source_section_uid\'] = organisation_uid_list or -1\n
line_params["mirror_section_uid"] = organisation_uid_list or -1\n
elif report_type:\n
catalog_params[\'default_destination_section_uid\'] = organisation_uid_list or -1\n
line_params["section_uid"] = organisation_uid_list or -1\n
else:\n
raise ValueError("Section category must be defined for report")\n
# add category params if defined\n
if incoterm not in (\'\', None):\n
incoterm_uid = category_tool.incoterm.restrictedTraverse(incoterm).getUid()\n
catalog_params[\'default_incoterm_uid\'] = incoterm_uid\n
if order not in (\'\', None):\n
order_uid = category_tool.order.restrictedTraverse(order).getUid()\n
catalog_params[\'default_order_uid\'] = order_uid\n
if delivery_mode not in (\'\', None):\n
delivery_mode_uid = category_tool.delivery_mode.restrictedTraverse(delivery_mode).getUid()\n
catalog_params[\'default_delivery_mode_uid\'] = delivery_mode_uid\n
\n
# compute sql params, we group and order by date and portal type\n
if aggregation_level == "year":\n
date_format = "%Y"\n
elif aggregation_level == "month":\n
date_format = "%Y-%m"\n
elif aggregation_level == "week":\n
date_format = "%Y-%U"\n
elif aggregation_level == "day":\n
date_format = "%Y-%m-%d"\n
\n
params = {"delivery.start_date":(from_date, to_date)}\n
query=None\n
if from_date is not None and to_date is not None:\n
params = {"delivery.start_date":(from_date, to_date)}\n
query = Query(range="minngt", **params)\n
elif from_date is not None:\n
params = {"delivery.start_date":from_date}\n
query = Query(range="min", **params)\n
elif to_date is not None:\n
params = {"delivery.start_date":to_date}\n
query = Query(range="ngt", **params)\n
\n
select_params = {"select_list" : [\'source_section_title\', \'destination_section_title\', \n
\'delivery.start_date\']}\n
\n
# sort_on_list = [ (\'delivery.destination_section_uid\', \'ASC\'), (\'delivery.start_date\',\'ASC\')]\n
\n
active_process_value = portal.portal_activities.newContent(\n
portal_type=\'Active Process\',)\n
catalog_params.update(select_params)\n
portal.portal_catalog.activate(tag=tag).searchAndActivate(\n
method_id="OrderModule_processOrderStat",\n
method_kw = {\'active_process\' : active_process_value.getPath(), \n
\'line_params\' : line_params, \n
\'date_format\' : date_format,\n
\'report_type\' : report_type,\n
\'report_group_by\' : report_group_by},\n
select_method_id = \'OrderModule_filterOrderStatResul\',\n
activate_kw = {\'priority\' : 7,\n
\'tag\' : tag,\n
},\n
# All SQL Params\n
query=query,\n
portal_type=doc_portal_type,\n
simulation_state=simulation_state,\n
packet_size=1000,\n
**catalog_params\n
)\n
\n
return active_process_value\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, period_list, report_type, doc_portal_type, line_portal_type, simulation_state,**kw
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_activateGetOrderStatList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_filterOrderStatResul.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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>
return [{\'uid\' : x.uid, \'start_date\' : x.start_date, \n
\'source_section_title\' : x.source_section_title, \n
\'destination_section_title\' : x.destination_section_title} for x in row_list]\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
row_list
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_filterOrderStatResul
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReport.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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>
return context.OrderModule_launchOrderReport(\n
report_method_id = "OrderModule_viewOrderReport",\n
*args,\n
**kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_getOrderReport
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportParameterDict.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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.DateUtils import getIntervalListBetweenDates\n
from DateTime import DateTime\n
\n
request = container.REQUEST\n
# list only if user has a login defined\n
aggregation_level = request.get(\'aggregation_level\')\n
from_date = request.get(\'from_date\')\n
to_date = request.get(\'at_date\')\n
group_by = request.get(\'group_by\')\n
simulation_state = request.get(\'simulation_state\', ())\n
\n
# define some parameter dependings on module\n
if "Sale" in context.getPortalType():\n
report_type = "sale"\n
line_portal_type = "Sale Order Line"\n
doc_portal_type = "Sale Order"\n
elif "Purchase" in context.getPortalType():\n
report_type = "purchase"\n
line_portal_type = "Purchase Order Line"\n
doc_portal_type = "Purchase Order"\n
elif request.get(\'order_report_document_portal_type\'):\n
doc_portal_type = request.get(\'order_report_document_portal_type\')\n
if doc_portal_type == \'Purchase Invoice Transaction\':\n
line_portal_type = \'Invoice Line\'\n
report_type = \'purchase\'\n
elif doc_portal_type == \'Sale Invoice Transaction\':\n
line_portal_type = \'Invoice Line\'\n
report_type = \'sale\'\n
else:\n
raise ValueError("unknown document portal type for report %s" % doc_portal_type)\n
else:\n
raise ValueError("unknown type for report")\n
\n
selection_columns = [(\'group_by\', "Group by")]\n
if from_date is None:\n
# get the minimum start date in catalog\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
kw = {"delivery.start_date" : None, "key":"DefaultKey"}\n
q = NegatedQuery(Query(**kw))\n
select_expression = "MIN(delivery.start_date)"\n
group_by = "delivery.start_date"\n
from_date = DateTime()\n
result_list = context.portal_catalog(\n
select_expression=select_expression,\n
group_by_expression=group_by,\n
simulation_state=simulation_state,\n
portal_type=doc_portal_type,\n
query=q,\n
limit=1)\n
if result_list:\n
from_date = DateTime(result_list[0][2])\n
\n
\n
# get period list between given date\n
interval_list_dict = getIntervalListBetweenDates(from_date=from_date, to_date=to_date,\n
keys={\'year\':aggregation_level=="year",\n
\'month\':aggregation_level=="month",\n
\'week\' : aggregation_level=="week",\n
\'day\':aggregation_level=="day"})\n
interval_list = interval_list_dict[aggregation_level]\n
\n
# FIXME: translate column names\n
# list columns of the listbox\n
interval_column_list = []\n
if group_by == "client":\n
interval_column_list.extend([("Amount %s" %x,"Amount %s" %x) for x in interval_list])\n
selection_columns = [(\'client\', "Client")]\n
total_column_list = [(\'total amount\', \'Total Amount\'),]\n
stat_columns = [(\'client\', "client")]\n
total_stat_list = [(\'total amount\', \'total amount\'),]\n
else:\n
if group_by == "product":\n
selection_columns = [(\'product\', "Product")]\n
stat_columns = [(\'product\', "product")]\n
else:\n
selection_columns = [(\'client\', "Client"), (\'product\', "Product")]\n
stat_columns = [(\'client\', "client"), (\'product\', "product")]\n
for x in interval_list:\n
interval_column_list.extend([("Amount %s" %x,"Amount %s" %x), ("Quantity %s" %x,"Quantity %s" %x),\n
("Quantity Unit %s" %x,"Quantity Unit %s" %x)])\n
total_column_list = [(\'total amount\', \'Total Amount\'),(\'total quantity\', \'Total Quantity\')]\n
total_stat_list = [(\'total amount\', \'total amount\'),(\'total quantity\', \'total quantity\')]\n
\n
selection_columns.extend(interval_column_list)\n
selection_columns.extend(total_column_list)\n
\n
params=dict(period_list=interval_list, report_type=report_type,\n
doc_portal_type=doc_portal_type, line_portal_type=line_portal_type,\n
simulation_state=simulation_state)\n
\n
stat_columns = stat_columns + interval_column_list + total_stat_list\n
\n
return params, stat_columns, selection_columns\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_getOrderReportParameterDict
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportSectionList.xml
View file @
c9cea662
...
...
@@ -51,101 +51,12 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ERP5Form.Report import ReportSection\n
from Products.ERP5Type.DateUtils import getIntervalListBetweenDates\n
from DateTime import DateTime\n
result=[]\n
\n
request = container.REQUEST\n
# list only if user has a login defined\n
aggregation_level = request.get(\'aggregation_level\')\n
from_date = request.get(\'from_date\')\n
to_date = request.get(\'at_date\')\n
group_by = request.get(\'group_by\')\n
simulation_state = request.get(\'simulation_state\', ())\n
\n
# define some parameter dependings on module\n
if "Sale" in context.getPortalType():\n
report_type = "sale"\n
line_portal_type = "Sale Order Line"\n
doc_portal_type = "Sale Order"\n
elif "Purchase" in context.getPortalType():\n
report_type = "purchase"\n
line_portal_type = "Purchase Order Line"\n
doc_portal_type = "Purchase Order"\n
elif request.get(\'order_report_document_portal_type\'):\n
doc_portal_type = request.get(\'order_report_document_portal_type\')\n
if doc_portal_type == \'Purchase Invoice Transaction\':\n
line_portal_type = \'Invoice Line\'\n
report_type = \'purchase\'\n
elif doc_portal_type == \'Sale Invoice Transaction\':\n
line_portal_type = \'Invoice Line\'\n
report_type = \'sale\'\n
else:\n
raise ValueError, "unknown document portal type for report %s" % doc_portal_type\n
else:\n
raise ValueError, "unknown type for report"\n
\n
selection_columns = [(\'group_by\', "Group by")]\n
if from_date is None:\n
# get the minimum start date in catalog\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
kw = {"delivery.start_date" : None, "key":"DefaultKey"}\n
q = NegatedQuery(Query(**kw))\n
select_expression = "MIN(delivery.start_date)"\n
group_by = "delivery.start_date"\n
from_date = DateTime()\n
result_list = context.portal_catalog(\n
select_expression=select_expression,\n
group_by_expression=group_by,\n
simulation_state=simulation_state,\n
portal_type=doc_portal_type,\n
query=q,\n
limit=1)\n
if result_list:\n
from_date = DateTime(result_list[0][2])\n
\n
\n
# get period list between given date\n
interval_list_dict = getIntervalListBetweenDates(from_date=from_date, to_date=to_date,\n
keys={\'year\':aggregation_level=="year",\n
\'month\':aggregation_level=="month",\n
\'week\' : aggregation_level=="week",\n
\'day\':aggregation_level=="day"})\n
interval_list = interval_list_dict[aggregation_level]\n
\n
# FIXME: translate column names\n
# list columns of the listbox\n
interval_column_list = []\n
if group_by == "client":\n
interval_column_list.extend([("Amount %s" %x,"Amount %s" %x) for x in interval_list])\n
selection_columns = [(\'client\', "Client")]\n
stat_columns = [(\'client\', "client")]\n
total_column_list = [(\'total amount\', \'Total Amount\'),]\n
total_stat_list = [(\'total amount\', \'total amount\'),]\n
else:\n
if group_by == "product":\n
selection_columns = [(\'product\', "Product")]\n
stat_columns = [(\'product\', "product")]\n
else:\n
selection_columns = [(\'client\', "Client"), (\'product\', "Product")]\n
stat_columns = [(\'client\', "client"), (\'product\', "product")]\n
for x in interval_list:\n
interval_column_list.extend([("Amount %s" %x,"Amount %s" %x), ("Quantity %s" %x,"Quantity %s" %x),\n
("Quantity Unit %s" %x,"Quantity Unit %s" %x)])\n
total_column_list = [(\'total amount\', \'Total Amount\'),(\'total quantity\', \'Total Quantity\')]\n
total_stat_list = [(\'total amount\', \'total amount\'),(\'total quantity\', \'total quantity\')]\n
params, stat_columns, selection_columns = context.OrderModule_getOrderReportParameterDict()\n
\n
selection_columns.extend(interval_column_list)\n
selection_columns.extend(total_column_list)\n
\n
params=dict(period_list=interval_list, report_type=report_type,\n
doc_portal_type=doc_portal_type, line_portal_type=line_portal_type,\n
simulation_state=simulation_state)\n
\n
# stat columns of the listbox\n
stat_columns = stat_columns + interval_column_list + total_stat_list\n
context.REQUEST.set(\'stat_columns\', stat_columns)\n
\n
result=[]
\n
result.append(ReportSection(\n
path=context.getPhysicalPath(),\n
selection_columns=selection_columns,\n
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.xml
View file @
c9cea662
...
...
@@ -53,132 +53,62 @@
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.PythonScripts.standard import Object\n
from
Products.ZSQLCatalog.SQLCatalog import Query
\n
from
json import loads
\n
\n
portal = context.getPortalObject()\n
category_tool = portal.portal_categories\n
\n
request = container.REQUEST\n
from_date = request.get(\'from_date\', None)\n
to_date = request.get(\'at_date\', None)\n
aggregation_level = request.get(\'aggregation_level\', None)\n
report_group_by = request.get(\'group_by\', None)\n
# get all category\n
incoterm = request.get(\'incoterm\', None)\n
section_category = request.get(\'section_category\', None)\n
order = request.get(\'order\', None)\n
delivery_mode = request.get(\'delivery_mode\', None)\n
\n
catalog_params = {}\n
\n
# get all organisations for the selected section category\n
if section_category:\n
group_uid = category_tool.getCategoryValue(section_category).getUid()\n
organisation_uid_list = [x.uid for x in portal.portal_catalog(\n
portal_type="Organisation",\n
default_group_uid=group_uid)]\n
if report_type == "sale":\n
catalog_params[\'default_source_section_uid\'] = organisation_uid_list or -1\n
elif report_type:\n
catalog_params[\'default_destination_section_uid\'] = organisation_uid_list or -1\n
\n
# add category params if defined\n
if incoterm not in (\'\', None):\n
incoterm_uid = category_tool.incoterm.restrictedTraverse(incoterm).getUid()\n
catalog_params[\'default_incoterm_uid\'] = incoterm_uid\n
if order not in (\'\', None):\n
order_uid = category_tool.order.restrictedTraverse(order).getUid()\n
catalog_params[\'default_order_uid\'] = order_uid\n
if delivery_mode not in (\'\', None):\n
delivery_mode_uid = category_tool.delivery_mode.restrictedTraverse(delivery_mode).getUid()\n
catalog_params[\'default_delivery_mode_uid\'] = delivery_mode_uid\n
\n
# compute sql params, we group and order by date and portal type\n
if aggregation_level == "year":\n
date_format = "%Y"\n
elif aggregation_level == "month":\n
date_format = "%Y-%m"\n
elif aggregation_level == "week":\n
date_format = "%Y-%U"\n
elif aggregation_level == "day":\n
date_format = "%Y-%m-%d"\n
\n
params = {"delivery.start_date":(from_date, to_date)}\n
query=None\n
if from_date is not None and to_date is not None:\n
params = {"delivery.start_date":(from_date, to_date)}\n
query = Query(range="minngt", **params)\n
elif from_date is not None:\n
params = {"delivery.start_date":from_date}\n
query = Query(range="min", **params)\n
elif to_date is not None:\n
params = {"delivery.start_date":to_date}\n
query = Query(range="ngt", **params)\n
\n
sort_on_list = [ (\'delivery.destination_section_uid\', \'ASC\'), (\'delivery.start_date\',\'ASC\')]\n
\n
if request.get(\'use_selection\'):\n
selection_name = request[\'selection_name\']\n
result_list = \\\n
context.portal_selections.callSelectionFor(request[\'selection_name\'])\n
else:\n
result_list = context.portal_catalog.searchResults(limit=None,query=query,\n
portal_type=doc_portal_type,\n
simulation_state=simulation_state,\n
sort_on=sort_on_list,\n
**catalog_params)\n
active_process_path = request.get(\'active_process\')\n
\n
# We have to sum product_dict and client_dict from the results of active process\n
def _addDict(global_dict, local_dict, only_amount=False):\n
if report_group_by == "both" and not only_amount:\n
# we have client ->
product -> period -> amount\n
for local_title, local_product_dict in local_dict.iteritems():\n
product_dict = global_dict.setdefault(local_title, {})\n
for local_product, local_period_dict in local_product_dict.iteritems():\n
period_dict = product_dict.setdefault(local_product, {})\n
for period, local_amount_dict in local_period_dict.iteritems():\n
amount_dict = period_dict.setdefault(period, {\'amount\' : 0, \'quantity\' : 0, \'quantity_unit\' : \'\'})\n
amount_dict[\'amount\'] = amount_dict[\'amount\'] + local_amount_dict[\'amount\']\n
amount_dict[\'quantity\'] = amount_dict[\'quantity\'] + local_amount_dict[\'quantity\']\n
amount_dict[\'quantity_unit\'] = local_amount_dict[\'quantity_unit\']\n
else:\n
# We have client or product -> period -> amount\n
for local_title, local_period_dict in local_dict.iteritems():\n
period_dict = global_dict.setdefault(local_title, {})\n
for period, local_amount_dict in local_period_dict.iteritems():\n
amount_dict = period_dict.setdefault(period, {\'amount\' : 0, \'quantity\' : 0, \'quantity_unit\' : \'\'})\n
amount_dict[\'amount\'] = amount_dict[\'amount\'] + local_amount_dict[\'amount\']\n
if not only_amount:\n
amount_dict[\'quantity\'] = amount_dict[\'quantity\'] + local_amount_dict[\'quantity\']\n
amount_dict[\'quantity_unit\'] = local_amount_dict[\'quantity_unit\']\n
\n
# we build two dict, one that store amount per period per client\n
# and another that either store amount per period per product and per client\n
# or only amount per period per product dependings on choosen group by\n
client_dict = {}\n
product_dict = {}\n
for result in result_list:\n
result = result.getObject()\n
period = result.getStartDate()\n
if period is not None:\n
period = period.strftime(date_format)\n
if report_group_by in ("client", "both"):\n
# client_title ->
period -> amount\n
if report_type == "sale":\n
client_title = result.getDestinationSectionTitle()\n
client_dict = {}\n
if active_process_path:\n
active_process = portal.restrictedTraverse(active_process_path)\n
for result in active_process.getResultList():\n
if result.summary:\n
continue\n
detail = loads(result.detail)\n
if detail[\'type\'] == "result":\n
result_product_dict = detail[\'product_dict\']\n
result_client_dict = detail["client_dict"] \n
else:\n
client_title = result.getSourceSectionTitle()\n
# FIXME: if two clients have the same title, do we want to group ?\n
if not client_dict.has_key(client_title):\n
client_dict[client_title] = {}\n
if client_dict[client_title].has_key(period):\n
client_dict[client_title][period][\'amount\'] = client_dict[client_title][period][\'amount\'] + result.getTotalPrice()\n
continue\n
if not len(client_dict) and len(result_client_dict):\n
client_dict = result_client_dict.copy()\n
else:\n
client_dict[client_title][period] = {\'amount\' : result.getTotalPrice()}\n
if not product_dict.has_key(client_title):\n
line_dict = product_dict[client_title] = {}\n
_addDict(client_dict, result_client_dict, only_amount=True)\n
\n
if not len(product_dict) and len(result_product_dict):\n
product_dict = result_product_dict.copy()\n
else:\n
line_dict = product_dict[client_title]\n
else:\n
line_dict = product_dict\n
\n
if report_group_by != "client":\n
# client_title -> product_title -> period -> amount/quantity...\n
# or product_title -> period -> amount/quantity...\n
for line in result.contentValues(filter = {\'portal_type\':line_portal_type}):\n
# FIXME: if two resources have the same title, do we want to group ?\n
product_title = line.getResourceTitle()\n
if not line_dict.has_key(product_title):\n
line_dict[product_title] = {period :{"amount" : line.getTotalPrice(),\n
"quantity" : line.getTotalQuantity(),\n
"quantity_unit" : line.getQuantityUnitTranslatedTitle()}}\n
else:\n
if not line_dict[product_title].has_key(period):\n
line_dict[product_title][period] = {"amount" : line.getTotalPrice(),\n
"quantity" : line.getTotalQuantity(),\n
"quantity_unit" : line.getQuantityUnitTranslatedTitle()}\n
else:\n
line_dict[product_title][period][\'amount\'] = line_dict[product_title][period][\'amount\'] + line.getTotalPrice()\n
line_dict[product_title][period][\'quantity\'] = line_dict[product_title][period][\'quantity\'] + line.getTotalQuantity()\n
\n
\n
_addDict(product_dict, result_product_dict)\n
else:\n
raise ValueError("No active process found to process report")\n
\n
def sortProduct(a, b):\n
return cmp(a[\'product\'], b[\'product\'])\n
...
...
@@ -312,6 +242,14 @@ return line_list\n
<key>
<string>
_params
</string>
</key>
<value>
<string>
period_list, report_type, doc_portal_type, line_portal_type, simulation_state,**kw
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_getOrderStatList
</string>
</value>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_launchOrderReport.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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>
# Run a first batch of calcul in activity\n
# Then call the report in a deferred mode\n
from json import dumps\n
from Products.CMFActivity.ActiveResult import ActiveResult\n
portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
# Check deferred style is present\n
if not \'Deferred\' in portal.portal_skins.getSkinSelections():\n
return context.Base_redirect(\'view\', keep_items=dict(\n
portal_status_message=N_("Deferred style must be installed to run this report")))\n
\n
person_value = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
if person_value is None:\n
portal.changeSkin(None)\n
return context.Base_redirect(\'view\', keep_items=dict(\n
portal_status_message=N_("No person found for your user")))\n
\n
if person_value.getDefaultEmailText(\'\') in (\'\', None):\n
portal.changeSkin(None)\n
return context.Base_redirect(\'view\', keep_items=dict(\n
portal_status_message=N_("You haven\'t defined your email address")))\n
\n
parameter_dict, stat_columns, selection_columns = context.OrderModule_getOrderReportParameterDict()\n
\n
active_process = context.OrderModule_activateGetOrderStatList(tag=script.id, **parameter_dict)\n
\n
# Create a result to store computed parameter for later\n
active_process.postResult(ActiveResult(\n
sevrity=1,\n
detail=dumps({\n
\'type\' : \'parameters\',\n
\'params\' : parameter_dict,\n
\'stat_columns\' : stat_columns,\n
\'selection_columns\' : selection_columns,\n
})\n
))\n
\n
request = context.REQUEST\n
context.getPortalObject().portal_skins.changeSkin("Deferred")\n
request.set(\'portal_skin\', "Deferred")\n
deferred_portal_skin = kw.get(\'portal_skin\')\n
request.set(\'deferred_portal_skin\', deferred_portal_skin)\n
\n
kw[\'deferred_style\'] = 1\n
kw[\'active_process\'] = active_process.getPath()\n
request.set(\'active_process\', active_process.getPath())\n
kw.update(parameter_dict)\n
kw.pop(\'format\',None)\n
return context.Base_activateReport(\n
form = getattr(context, report_method_id),\n
after_tag=script.id,\n
**kw\n
)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
report_method_id, *args, **kw
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_launchOrderReport
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_processOrderStat.xml
0 → 100644
View file @
c9cea662
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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
encoding=
"cdata"
>
<![CDATA[
from json import dumps\n
from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
# we build two dict, one that store amount per period per lient\n
# and another that either store amount per period per product and per client\n
# or only amount per period per product dependings on choosen group by\n
client_dict = {}\n
product_dict = {}\n
portal = context.getPortalObject()\n
translate = portal.Base_translateString\n
# Retrieve all lines related to documents\n
line_list = portal.portal_catalog(explanation_uid=[x[\'uid\'] for x in document_list],\n
select_list=[\'total_price\', \'quantity\', \'resource_title\', \'strict_quantity_unit_title\', \'explanation_uid\'],\n
**line_params)\n
\n
doc_line_dict = {}\n
for line in line_list:\n
doc_lines = doc_line_dict.setdefault(line.explanation_uid, [])\n
doc_lines.append(line)\n
\n
for result in document_list:\n
try:\n
line_list = doc_line_dict[result[\'uid\']]\n
except KeyError:\n
line_list = []\n
\n
period = result[\'start_date\']\n
if period is not None:\n
period = period.strftime(date_format)\n
if report_group_by in ("client", "both"):\n
total_price = sum([(x.total_price or 0) for x in line_list])\n
# client_title ->
period -> amount\n
if report_type == "sale":\n
client_title = result[\'destination_section_title\']\n
else:\n
client_title = result[\'source_section_title\']\n
# FIXME: if two clients have the same title, do we want to group ?\n
if not client_dict.has_key(client_title):\n
client_dict[client_title] = {}\n
if client_dict[client_title].has_key(period):\n
client_dict[client_title][period][\'amount\'] = client_dict[client_title][period][\'amount\'] + (total_price or 0)\n
else:\n
client_dict[client_title][period] = {\'amount\' : total_price or 0}\n
if not product_dict.has_key(client_title):\n
line_dict = product_dict[client_title] = {}\n
else:\n
line_dict = product_dict[client_title]\n
else:\n
line_dict = product_dict\n
\n
if report_group_by != "client":\n
# client_title -> product_title -> period -> amount/quantity...\n
# or product_title -> period -> amount/quantity...\n
for line in line_list: \n
# FIXME: if two resources have the same title, do we want to group ?\n
product_title = line.resource_title\n
if not line_dict.has_key(product_title):\n
line_dict[product_title] = {period :{"amount" : line.total_price or 0,\n
"quantity" : line.quantity or 0,\n
"quantity_unit" : translate(line.strict_quantity_unit_title)}}\n
else:\n
if not line_dict[product_title].has_key(period):\n
line_dict[product_title][period] = {"amount" : line.total_price or 0,\n
"quantity" : line.quantity or 0,\n
"quantity_unit" : translate(line.strict_quantity_unit_title)}\n
else:\n
line_dict[product_title][period][\'amount\'] = line_dict[product_title][period][\'amount\'] + (line.total_price or 0)\n
line_dict[product_title][period][\'quantity\'] = line_dict[product_title][period][\'quantity\'] + (line.quantity or 0)\n
\n
active_process_value = portal.restrictedTraverse(active_process)\n
active_process_value.postResult(ActiveResult(\n
sevrity=1,\n
detail=dumps({\n
\'type\' : "result",\n
\'client_dict\' : client_dict,\n
\'product_dict\' : product_dict,\n
})\n
))\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
document_list, active_process, line_params, date_format, report_type, report_group_by
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
OrderModule_processOrderStat
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml
View file @
c9cea662
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5
Form"
module=
"Products.ERP5Form.Form
"
/>
<global
name=
"ERP5
Form"
module=
"erp5.portal_type
"
/>
</pickle>
<pickle>
<dictionary>
...
...
@@ -35,7 +35,7 @@
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
OrderModule_
view
OrderReport
</string>
</value>
<value>
<string>
OrderModule_
get
OrderReport
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -83,7 +83,6 @@
<list>
<string>
your_portal_skin
</string>
<string>
your_format
</string>
<string>
your_deferred_style
</string>
</list>
</value>
</item>
...
...
@@ -104,7 +103,6 @@
<string>
your_incoterm
</string>
<string>
your_order
</string>
<string>
your_landscape
</string>
<string>
your_use_selection
</string>
</list>
</value>
</item>
...
...
@@ -157,6 +155,10 @@
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
...
...
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_deferred_style.xml
deleted
100644 → 0
View file @
04cc454b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_deferred_style
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_dialog_mode_deferred_style
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewTradeFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_use_selection.xml
deleted
100644 → 0
View file @
04cc454b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_use_selection
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_dialog_mode_use_selection
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewTradeFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment