Commit 074462d9 authored by Jérome Perrin's avatar Jérome Perrin

support funding and function to be passed as a document, not a category

Signed-off-by: Aurel's avatarAurélien Calonne <aurel@nexedi.com>
parent 243a4bed
......@@ -90,11 +90,19 @@ if portal_type and portal_type != portal.getPortalAccountingTransactionTypeList(
if function:\n
if function == \'None\':\n
inventory_params[\'function_uid\'] = Query(function_uid=None)\n
else:\n
function_value = portal.restrictedTraverse(function, None)\n
if function_value is not None and function_value.getPortalType() != \'Category\':\n
inventory_params[\'function_uid\'] = function_value.getUid()\n
else:\n
inventory_params[\'function_category\'] = function\n
if funding:\n
if funding == \'None\':\n
inventory_params[\'funding_uid\'] = Query(funding_uid=None)\n
else:\n
funding_value = portal.restrictedTraverse(funding, None)\n
if funding_value is not None and funding_value.getPortalType() != \'Category\':\n
inventory_params[\'funding_uid\'] = funding_value.getUid()\n
else:\n
inventory_params[\'funding_category\'] = funding\n
if project:\n
......
......@@ -120,8 +120,16 @@ if project:\n
else:\n
params[\'project_uid\'] = traverse(project).getUid()\n
if function:\n
function_value = traverse(function, None)\n
if function_value is not None and function_value.getPortalType() != \'Category\':\n
params[\'function_uid\'] = function_value.getUid()\n
else:\n
params[\'function_category\'] = function\n
if funding:\n
funding_value = traverse(funding, None)\n
if funding_value is not None and funding_value.getPortalType() != \'Category\':\n
params[\'funding_uid\'] = funding_value.getUid()\n
else:\n
params[\'funding_category\'] = funding\n
if mirror_section:\n
params[\'mirror_section_uid\'] = traverse(mirror_section).getUid()\n
......
......@@ -104,6 +104,7 @@ if project:\n
params[\'project_uid\'] = Query(project_uid=None)\n
else:\n
params[\'project_uid\'] = portal.portal_categories.restrictedTraverse(project).getUid()\n
\n
funding_category = request.get(\'funding\')\n
if funding_category:\n
if funding_category == \'None\':\n
......
......@@ -60,8 +60,12 @@ inventory_kw = dict(section_uid=section_uid,\n
)\n
if function_category:\n
inventory_kw[\'function_category\'] = function_category\n
if function_uid:\n
inventory_kw[\'function_uid\'] = function_uid\n
if funding_category:\n
inventory_kw[\'funding_category\'] = funding_category\n
if funding_uid:\n
inventory_kw[\'funding_uid\'] = funding_uid\n
if project_uid:\n
inventory_kw[\'project_uid\'] = project_uid\n
if mirror_section_category:\n
......@@ -114,7 +118,7 @@ return [Object(debit_price=debit, credit_price=credit)]\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>section_uid, simulation_state, at_date, period_start_date, precision, node_category=None, function_category=None, funding_category=None, project_uid=None, from_date=\'ignored\', mirror_section_category=None, mirror_section_uid=None, **kw</string> </value>
<value> <string>section_uid, simulation_state, at_date, period_start_date, precision, node_category=None, function_category=None, function_uid=None, funding_category=None, funding_uid=None, project_uid=None, from_date=\'ignored\', mirror_section_category=None, mirror_section_uid=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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