Commit 745fbc9a authored by wenjie.zheng's avatar wenjie.zheng

Merge branch 'master' into erp5_workflow

parents 7137c6d8 fe53a328
......@@ -501,7 +501,8 @@ for node in getInventoryList(\n
\n
# payable / receivable accounts {{{\n
# initial balance\n
for node in getInventoryList(\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
......@@ -524,7 +525,8 @@ for node in getInventoryList(\n
\n
found_balance=False\n
# Balance Transactions\n
for node in getInventoryList(\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
......@@ -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:
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)
......
......@@ -90,7 +90,11 @@
<list>
<tuple>
<string>title</string>
<string>Name</string>
<string>Usual Name</string>
</tuple>
<tuple>
<string>corporate_name</string>
<string>Corporate Name</string>
</tuple>
<tuple>
<string>site_translated_title</string>
......@@ -136,6 +140,10 @@
<string>price_currency_reference</string>
<string>Accounting Currency</string>
</tuple>
<tuple>
<string>owner_title</string>
<string>Owner</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>Creation Date</string>
......@@ -256,7 +264,7 @@
<list>
<tuple>
<string>title</string>
<string>Name</string>
<string>Usual Name</string>
</tuple>
<tuple>
<string>child_telephone_SearchableText</string>
......@@ -307,7 +315,7 @@
<list>
<tuple>
<string>title</string>
<string>Title</string>
<string>Usual Name</string>
</tuple>
</list>
</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
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>
......@@ -71,7 +71,7 @@ if budget_line is not None:\n
if budget_variation.hasTitle():\n
base_category_title_dict[\n
budget_variation.getProperty(\'variation_base_category\')\n
] = budget_variation.getTitle()\n
] = budget_variation.getTranslatedTitle()\n
base_category_int_index_dict[\n
budget_variation.getProperty(\'variation_base_category\')\n
] = budget_variation.getIntIndex()\n
......@@ -89,10 +89,10 @@ for item in item_list:\n
item_key = string.join(item_split[:split_depth] , \'/\' )\n
base_category = item_split[0]\n
multi = True\n
\n
\n
if item_key in line_level_variation_list:\n
multi = False\n
\n
\n
if not sub_field_dict.has_key(item_key):\n
# Create property dict\n
sub_field_property_dict = default_sub_field_property_dict.copy()\n
......@@ -106,7 +106,7 @@ for item in item_list:\n
\n
sub_field_dict[item_key][\'item_list\'] =\\\n
sub_field_dict[item_key][\'item_list\'] + [item]\n
\n
\n
if item_value in value_list:\n
if multi:\n
sub_field_dict[item_key][\'value\'] =\\\n
......@@ -125,10 +125,8 @@ for item in item_list:\n
sub_field_dict[item_key][\'title\'] = base_category_value.getTranslatedTitle()\n
else:\n
sub_field_dict[item_key][\'title\'] = base_category\n
\n
sub_field_values = sub_field_dict.values()\n
sub_field_values.sort(key=lambda d:d[\'int_index\'])\n
return sub_field_values\n
\n
return sorted(sub_field_dict.values(), key=lambda d:d[\'int_index\'])\n
</string> </value>
</item>
<item>
......
......@@ -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>
......
......@@ -57,6 +57,23 @@ item_list = filter(lambda x: x not in [(\'\',\'\'), [\'\',\'\']],\\\n
sub_field_dict = {}\n
split_depth = 1\n
\n
# Build a dict of title to display, based on the titles of corresponding\n
# budget variations, and a dict of indexes for sorting.\n
base_category_title_dict = {}\n
base_category_int_index_dict = {}\n
budget = container.REQUEST.get(\'here\')\n
if budget is not None:\n
budget_model =budget.getSpecialiseValue()\n
if budget_model is not None:\n
for budget_variation in budget_model.contentValues():\n
if budget_variation.hasTitle():\n
base_category_title_dict[\n
budget_variation.getProperty(\'variation_base_category\')\n
] = budget_variation.getTranslatedTitle()\n
base_category_int_index_dict[\n
budget_variation.getProperty(\'variation_base_category\')\n
] = budget_variation.getIntIndex()\n
\n
resolveCategory = context.getPortalObject().portal_categories.resolveCategory\n
\n
for item in item_list:\n
......@@ -67,42 +84,44 @@ for item in item_list:\n
item_split = string.split(item_value, \'/\')\n
item_key = string.join(item_split[:split_depth] , \'/\' )\n
base_category = item_split[0]\n
multi = False # XXX or now budget level are only single value.\n
\n
if not sub_field_dict.has_key(item_key):\n
# Create property dict\n
sub_field_property_dict = default_sub_field_property_dict.copy()\n
sub_field_property_dict[\'key\'] = item_key\n
sub_field_property_dict[\'required\'] = 0\n
\n
# XXX for each "item_key" we must check if it can be multivaluated or not\n
if 0:\n
sub_field_property_dict[\'field_type\'] = \'MultiListField\'\n
sub_field_property_dict[\'size\'] = 5\n
sub_field_property_dict[\'field_type\'] = \'ListField\'\n
sub_field_property_dict[\'size\'] = 1\n
\n
sub_field_property_dict[\'field_type\'] = multi and \'MultiListField\' or \'ListField\'\n
sub_field_property_dict[\'size\'] = multi and 15 or 1\n
sub_field_property_dict[\'item_list\'] = [(\'\',\'\')]\n
sub_field_property_dict[\'value\'] = []\n
sub_field_dict[item_key] = sub_field_property_dict\n
\n
sub_field_dict[item_key][\'item_list\'] =\\\n
sub_field_dict[item_key][\'item_list\'] + [item]\n
\n
if item_value in value_list:\n
# XXX for each "item_key" we must check if it can be multivaluated or not\n
if 0:\n
if multi:\n
sub_field_dict[item_key][\'value\'] =\\\n
sub_field_dict[item_key][\'value\'] + [item_value]\n
\n
else:\n
sub_field_dict[item_key][\'value\'] = item_value\n
\n
sub_field_dict[item_key][\'int_index\'] = base_category_int_index_dict.get(\n
base_category, -1)\n
\n
if base_category in base_category_title_dict:\n
sub_field_dict[item_key][\'title\'] = base_category_title_dict[base_category]\n
else:\n
base_category_value = resolveCategory(base_category)\n
if base_category_value is not None:\n
sub_field_dict[item_key][\'title\'] = base_category_value.getTranslatedTitle()\n
else:\n
sub_field_dict[item_key][\'title\'] = base_category\n
\n
return sub_field_dict.values()\n
\n
sub_field_values = sub_field_dict.values()\n
sub_field_values.sort(key=lambda d:d[\'int_index\'])\n
return sub_field_values\n
</string> </value>
</item>
<item>
......
......@@ -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
......
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