Commit 6a5dbad8 authored by wenjie.zheng's avatar wenjie.zheng

Merge branch 'erp5_workflow' into erp5_workflow_converted

parents bcd84c5d 62d56ea2
......@@ -501,49 +501,51 @@ for node in getInventoryList(\n
\n
# payable / receivable accounts {{{\n
# initial balance\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_mirror_section_previous_period,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
to_date=period_start_date,\n
portal_type=accounting_movement_type_list +\n
balance_movement_type_list,\n
**inventory_params):\n
mirror_section_key = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
if account_type_to_group_by_mirror_section_previous_period:\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_mirror_section_previous_period,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
to_date=period_start_date,\n
portal_type=accounting_movement_type_list +\n
balance_movement_type_list,\n
**inventory_params):\n
mirror_section_key = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
\n
account_props = line_per_account.setdefault(\n
getKey(node, mirror_section=mirror_section_key),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(-total_price, 0)\n
account_props = line_per_account.setdefault(\n
getKey(node, mirror_section=mirror_section_key),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(-total_price, 0)\n
\n
found_balance=False\n
# Balance Transactions\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_mirror_section_previous_period,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
from_date=from_date,\n
at_date=from_date + 1,\n
portal_type=balance_movement_type_list,\n
**inventory_params):\n
mirror_section_key = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
account_props = line_per_account.setdefault(\n
getKey(node, mirror_section=mirror_section_key),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(- total_price, 0)\n
found_balance=True\n
if account_type_to_group_by_mirror_section_previous_period:\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_mirror_section_previous_period,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
from_date=from_date,\n
at_date=from_date + 1,\n
portal_type=balance_movement_type_list,\n
**inventory_params):\n
mirror_section_key = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
account_props = line_per_account.setdefault(\n
getKey(node, mirror_section=mirror_section_key),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(- total_price, 0)\n
found_balance=True\n
\n
\n
period_movement_type_list = accounting_movement_type_list\n
......@@ -711,7 +713,7 @@ for key, data in line_per_account.items():\n
closing_balance = final_debit_balance - final_credit_balance\n
total_final_balance_if_debit += round(max(closing_balance, 0), precision)\n
total_final_balance_if_credit += round(max(-closing_balance, 0) or 0, precision)\n
\n
\n
line = Object(uid=\'new_\',\n
node_id=node_id,\n
node_title=node_title,\n
......
......@@ -7,7 +7,8 @@ from Products.CMFActivity.ActiveResult import ActiveResult
from Products.ERP5Type.Document import newTempOOoDocument
from zLOG import LOG, INFO
def dumpWorkflowChain(self):
def dumpWorkflowChain(self, ignore_default=False,
ignore_id_set=None, keep_order=False, batch_mode=False):
# This method outputs the workflow chain in the format that you can
# easily get diff like the following:
# ---
......@@ -15,6 +16,13 @@ def dumpWorkflowChain(self):
# Account,edit_workflow
# ...
# ---
# Parameters :
# - ignore_id_set : a set with workflow ids to exclude
# - keep_order : set to True if you would like to keep original order,
# default is to sort alphabetically
# - batch_mode : used to directly return the sctructure instead of return string
if ignore_id_set is None:
ignore_id_set = set()
workflow_tool = self.getPortalObject().portal_workflow
cbt = workflow_tool._chains_by_type
ti = workflow_tool._listTypeInfo()
......@@ -24,15 +32,25 @@ def dumpWorkflowChain(self):
title = t.Title()
if title == id_:
title = None
chain = None
if cbt is not None and cbt.has_key(id_):
chain = sorted(cbt[id_])
cbt_list = [x for x in cbt[id_] if not(x in ignore_id_set)]
if keep_order:
chain = cbt_list
else:
chain = sorted(cbt_list)
else:
chain = ['(Default)']
types_info.append({'id': id_,
if not(ignore_default):
chain = ['(Default)']
if chain:
types_info.append({'id': id_,
'title': title,
'chain': chain})
types_info.sort(key=lambda x:x['id'])
if batch_mode:
return types_info
output = []
for i in sorted(types_info, key=lambda x:x['id']):
for i in types_info:
for chain in i['chain']:
output.append('%s,%s' % (i['id'], chain))
return '\n'.join(output)
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>solver_process = state_change[\'object\'].getParentValue()\n
<value> <string>solver_process = state_change[\'object\'].aq_parent\n
if solver_process.getValidationState() == \'draft\':\n
solver_process.startSolving()\n
</string> </value>
......@@ -59,6 +59,14 @@ if solver_process.getValidationState() == \'draft\':\n
<key> <string>_params</string> </key>
<value> <string>state_change, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SolverProcess_startSolving</string> </value>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>solver_process = state_change[\'object\'].getParentValue()\n
<value> <string>solver_process = state_change[\'object\'].aq_parent\n
for solver in solver_process.objectValues(\n
portal_type=solver_process.getPortalObject().getPortalTargetSolverTypeList()):\n
if solver.getValidationState() != \'solved\':\n
......@@ -62,6 +62,14 @@ solver_process.succeed()\n
<key> <string>_params</string> </key>
<value> <string>state_change, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SolverProcess_succeed</string> </value>
......
<?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 ZTUtils import make_query\n
\n
def getFakeBudgetCell(amount):\n
class FakeBudgetCell:\n
def getAvailableBudget(self):\n
return amount\n
def getExplanationUrl(self, *args, **w):\n
return \'%s/BudgetLine_viewConsumedBudgetMovementList?%s\' % (\n
context.absolute_url(),\n
make_query(dict(cell_index=list(cell_index), engaged_budget=True)))\n
return FakeBudgetCell()\n
\n
try:\n
available_budget_dict = container.REQUEST.other[script.getId()]\n
except KeyError:\n
available_budget_dict = container.REQUEST.other[script.getId()] = context.getAvailableBudgetDict()\n
\n
return getFakeBudgetCell(available_budget_dict.get(cell_index))\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*cell_index, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BudgetLine_getAvailableBudgetCell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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 ZTUtils import make_query\n
\n
def getFakeBudgetCell(amount):\n
class FakeBudgetCell:\n
def getConsumedBudget(self):\n
return amount\n
def getExplanationUrl(self, *args, **w):\n
return \'%s/BudgetLine_viewConsumedBudgetMovementList?%s\' % (\n
context.absolute_url(),\n
make_query(dict(cell_index=list(cell_index), engaged_budget=False)))\n
return FakeBudgetCell()\n
\n
try:\n
consumed_budget_dict = container.REQUEST.other[script.getId()]\n
except KeyError:\n
consumed_budget_dict = container.REQUEST.other[script.getId()] = context.getConsumedBudgetDict()\n
\n
return getFakeBudgetCell(consumed_budget_dict.get(cell_index))\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*cell_index, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BudgetLine_getConsumedBudgetCell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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 ZTUtils import make_query\n
\n
def getFakeBudgetCell(amount):\n
class FakeBudgetCell:\n
def getEngagedBudget(self):\n
return amount\n
def getExplanationUrl(self, *args, **w):\n
return \'%s/BudgetLine_viewConsumedBudgetMovementList?%s\' % (\n
context.absolute_url(),\n
make_query(dict(cell_index=list(cell_index), engaged_budget=True)))\n
return FakeBudgetCell()\n
\n
try:\n
engaged_budget_dict = container.REQUEST.other[script.getId()]\n
except KeyError:\n
engaged_budget_dict = container.REQUEST.other[script.getId()] = context.getEngagedBudgetDict()\n
\n
return getFakeBudgetCell(engaged_budget_dict.get(cell_index))\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*cell_index, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BudgetLine_getEngagedBudgetCell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -81,7 +81,7 @@
</item>
<item>
<key> <string>cell_getter_method</string> </key>
<value> <string>BudgetLine_getAvailableBudgetCell</string> </value>
<value> <string>getAvailableBudgetCell</string> </value>
</item>
<item>
<key> <string>editable_attributes</string> </key>
......
......@@ -112,7 +112,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.getAvailableBudget()</string> </value>
<value> <string>cell/getAvailableBudget</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -81,7 +81,7 @@
</item>
<item>
<key> <string>cell_getter_method</string> </key>
<value> <string>BudgetLine_getConsumedBudgetCell</string> </value>
<value> <string>getConsumedBudgetCell</string> </value>
</item>
<item>
<key> <string>editable_attributes</string> </key>
......
......@@ -81,7 +81,7 @@
</item>
<item>
<key> <string>cell_getter_method</string> </key>
<value> <string>BudgetLine_getEngagedBudgetCell</string> </value>
<value> <string>getEngagedBudgetCell</string> </value>
</item>
<item>
<key> <string>editable_attributes</string> </key>
......
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -116,6 +116,7 @@
<string>my_int_index</string>
<string>my_effective_date</string>
<string>my_revision</string>
<string>my_translated_portal_type</string>
</list>
</value>
</item>
......
<?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>my_translated_portal_type</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_view_mode_translated_portal_type</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewDMSFieldLibrary</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>
......@@ -788,10 +788,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if is_site_root:\n
\n
result_dict[\'default_view\'] = \'view\'\n
# XXX Hardcoded cache for 30 minutes. Should only bother developers but speed up Jio access\n
response.setHeader("Cache-Control", "public, max-age=1800")\n
response.setHeader("Vary", "Cookie")\n
response.setHeader("Last-Modified", DateTime().rfc822())\n
REQUEST.set("X-HATEOAS-CACHE", 1)\n
\n
# Global action users for the jIO plugin\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_officejs_theme</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ckeditor</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>adapters</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>lang</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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