Commit 3e0f972b authored by Jérome Perrin's avatar Jérome Perrin

Add 'funding' in inventory API

To migrate, run:
alter table stock add column funding_uid bigint unsigned after payment_uid, add index funding_uid (funding_uid);
alter table inventory_stock add column funding_uid bigint unsigned after payment_uid;
parent 9f040229
......@@ -30,6 +30,8 @@ getSourceFunctionUid\r\n
getDestinationFunctionUid\r\n
getSourceProjectUid\r\n
getDestinationProjectUid\r\n
getSourceFundingUid\r\n
getDestinationFundingUid\r\n
getSimulationState\r\n
getSourceInventoriatedTotalAssetPrice\r\n
getDestinationInventoriatedTotalAssetPrice\r\n
......@@ -103,6 +105,7 @@ WHERE\n
getDestinationPaymentUid[loop_item],\n
getDestinationFunctionUid[loop_item],\n
getDestinationProjectUid[loop_item],\n
getDestinationFundingUid[loop_item],\n
getSourceSectionUid[loop_item],\n
getSourceUid[loop_item],\n
getResourceUid[loop_item],\n
......@@ -126,6 +129,7 @@ WHERE\n
getSourcePaymentUid[loop_item],\n
getSourceFunctionUid[loop_item],\n
getSourceProjectUid[loop_item],\n
getSourceFundingUid[loop_item],\n
getDestinationSectionUid[loop_item],\n
getDestinationUid[loop_item],\n
getResourceUid[loop_item],\n
......@@ -158,16 +162,17 @@ VALUES\n
<dtml-sqlvar expr="row_item[6]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[7]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[8]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[9]" type="int">, \n
<dtml-sqlvar expr="row_item[10]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[11]" type="int">, \n
<dtml-sqlvar expr="row_item[12]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[9]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[10]" type="int">, \n
<dtml-sqlvar expr="row_item[11]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[12]" type="int">, \n
<dtml-sqlvar expr="row_item[13]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[14]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[15]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[14]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[15]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[16]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[17]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[18]" type="string" optional>\n
<dtml-sqlvar expr="row_item[18]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[19]" type="string" optional>\n
)\n
<dtml-if sequence-end><dtml-else>,</dtml-if>\n
</dtml-in>\n
......
367
\ No newline at end of file
368
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>acquisition_append_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>acquisition_base_category</string> </key>
<value>
<tuple>
<string>order</string>
<string>parent</string>
</tuple>
</value>
</item>
<item>
<key> <string>acquisition_copy_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>acquisition_mask_value</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>acquisition_object_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: list( portal.getPortalAcquisitionMovementTypeList() + portal.getPortalItemTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList() + portal.getPortalOpenOrderTypeList())</string> </value>
</item>
<item>
<key> <string>acquisition_sync_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>destination_function</string>
<string>destination_project</string>
</tuple>
</value>
</item>
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>fallback_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>destination_funding</string> </value>
</item>
<item>
<key> <string>id_generator</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id_group</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Category</string> </value>
</item>
<item>
<key> <string>read_permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>rid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Destination Funding</string> </value>
</item>
<item>
<key> <string>write_permission</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>acquisition_append_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>acquisition_base_category</string> </key>
<value>
<tuple>
<string>order</string>
<string>parent</string>
</tuple>
</value>
</item>
<item>
<key> <string>acquisition_copy_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>acquisition_mask_value</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>acquisition_object_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: list( portal.getPortalAcquisitionMovementTypeList() + portal.getPortalItemTypeList() + portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalInvoiceTypeList() + portal.getPortalOpenOrderTypeList())</string> </value>
</item>
<item>
<key> <string>acquisition_sync_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>source_function</string>
<string>source_project</string>
</tuple>
</value>
</item>
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>fallback_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>source_funding</string> </value>
</item>
<item>
<key> <string>id_generator</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id_group</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Category</string> </value>
</item>
<item>
<key> <string>read_permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>rid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Source Funding</string> </value>
</item>
<item>
<key> <string>write_permission</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
......@@ -135,6 +135,7 @@ SELECT\n
<dtml-var stock_table_id>.mirror_node_uid as mirror_node_uid,\n
<dtml-var stock_table_id>.function_uid as function_uid,\n
<dtml-var stock_table_id>.project_uid as project_uid,\n
<dtml-var stock_table_id>.funding_uid as funding_uid,\n
catalog.path as path\n
</dtml-if>\n
<dtml-if statistic>\n
......
......@@ -501,10 +501,13 @@ SELECT\n
</dtml-if>\n
stock.variation_text AS variation_text,\n
stock.simulation_state AS simulation_state,\n
stock.resource_uid AS resource_uid,\n
stock.payment_uid AS payment_uid,\n
stock.mirror_section_uid AS mirror_section_uid,\n
stock.mirror_node_uid AS mirror_node_uid,\n
stock.function_uid AS function_uid,\n
stock.project_uid AS project_uid,\n
stock.funding_uid AS funding_uid,\n
node.uid AS node_uid,\n
node.title AS node_title,\n
node.relative_url AS node_relative_url,\n
......
......@@ -10,6 +10,7 @@ destination_account
destination_administration
destination_decision
destination_function
destination_funding
destination_payment
destination_payment_region
destination_project
......@@ -30,6 +31,7 @@ source_account
source_administration
source_decision
source_function
source_funding
source_payment
source_payment_region
source_project
......
......@@ -22,6 +22,8 @@ getSourceFunctionUid\r\n
getDestinationFunctionUid\r\n
getSourceProjectUid\r\n
getDestinationProjectUid\r\n
getSourceFundingUid\r\n
getDestinationFundingUid\r\n
getSimulationState\r\n
getSourceInventoriatedTotalAssetPrice\r\n
getDestinationInventoriatedTotalAssetPrice\r\n
......@@ -66,6 +68,7 @@ WHERE\n
getDestinationPaymentUid[loop_item],\n
getDestinationFunctionUid[loop_item],\n
getDestinationProjectUid[loop_item], \n
getDestinationFundingUid[loop_item], \n
getSourceSectionUid[loop_item], \n
getSourceUid[loop_item], \n
getResourceUid[loop_item],\n
......@@ -88,6 +91,7 @@ WHERE\n
getSourcePaymentUid[loop_item],\n
getSourceFunctionUid[loop_item],\n
getSourceProjectUid[loop_item], \n
getSourceFundingUid[loop_item], \n
getDestinationSectionUid[loop_item], \n
getDestinationUid[loop_item], \n
getResourceUid[loop_item],\n
......@@ -118,15 +122,16 @@ VALUES\n
<dtml-sqlvar expr="row_item[6]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[7]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[8]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[9]" type="int">, \n
<dtml-sqlvar expr="row_item[10]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[11]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[9]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[10]" type="int">, \n
<dtml-sqlvar expr="row_item[11]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[12]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[13]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[14]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[13]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[14]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[15]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[16]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[17]" type="string" optional>\n
<dtml-sqlvar expr="row_item[17]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[18]" type="string" optional>\n
)\n
<dtml-if sequence-end><dtml-else>,</dtml-if>\n
</dtml-in>\n
......
......@@ -30,6 +30,8 @@ getSourceFunctionUid\r\n
getDestinationFunctionUid\r\n
getSourceProjectUid\r\n
getDestinationProjectUid\r\n
getSourceFundingUid\r\n
getDestinationFundingUid\r\n
getSimulationState\r\n
getSourceInventoriatedTotalAssetPrice\r\n
getDestinationInventoriatedTotalAssetPrice\r\n
......@@ -101,6 +103,7 @@ WHERE\n
getDestinationPaymentUid[loop_item],\n
getDestinationFunctionUid[loop_item],\n
getDestinationProjectUid[loop_item], \n
getDestinationFundingUid[loop_item], \n
getSourceSectionUid[loop_item], \n
getSourceUid[loop_item], \n
getResourceUid[loop_item],\n
......@@ -124,6 +127,7 @@ WHERE\n
getSourcePaymentUid[loop_item],\n
getSourceFunctionUid[loop_item],\n
getSourceProjectUid[loop_item], \n
getSourceFundingUid[loop_item], \n
getDestinationSectionUid[loop_item], \n
getDestinationUid[loop_item], \n
getResourceUid[loop_item],\n
......@@ -155,16 +159,17 @@ VALUES\n
<dtml-sqlvar expr="row_item[6]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[7]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[8]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[9]" type="int">, \n
<dtml-sqlvar expr="row_item[10]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[11]" type="int">, \n
<dtml-sqlvar expr="row_item[12]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[9]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[10]" type="int">, \n
<dtml-sqlvar expr="row_item[11]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[12]" type="int">, \n
<dtml-sqlvar expr="row_item[13]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[14]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[15]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[14]" type="datetime" optional>,\n
<dtml-sqlvar expr="row_item[15]" type="float" optional>,\n
<dtml-sqlvar expr="row_item[16]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[17]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[18]" type="string" optional>\n
<dtml-sqlvar expr="row_item[18]" type="string" optional>,\n
<dtml-sqlvar expr="row_item[19]" type="string" optional>\n
)\n
<dtml-if sequence-end><dtml-else>,</dtml-if>\n
</dtml-in>\n
......
......@@ -28,6 +28,7 @@
`payment_uid` BIGINT UNSIGNED,\n
`function_uid` BIGINT UNSIGNED,\n
`project_uid` BIGINT UNSIGNED,\n
`funding_uid` BIGINT UNSIGNED,\n
`mirror_section_uid` BIGINT UNSIGNED,\n
`mirror_node_uid` BIGINT UNSIGNED,\n
`resource_uid` BIGINT UNSIGNED,\n
......
......@@ -64,6 +64,7 @@ CREATE TABLE `stock` (\n
`payment_uid` BIGINT UNSIGNED,\n
`function_uid` BIGINT UNSIGNED,\n
`project_uid` BIGINT UNSIGNED,\n
`funding_uid` BIGINT UNSIGNED,\n
`mirror_section_uid` BIGINT UNSIGNED,\n
`mirror_node_uid` BIGINT UNSIGNED,\n
`resource_uid` BIGINT UNSIGNED,\n
......@@ -85,6 +86,7 @@ CREATE TABLE `stock` (\n
KEY `payment_uid` (`payment_uid`),\n
KEY `function_uid` (`function_uid`),\n
KEY `project_uid` (`project_uid`),\n
KEY `funding_uid` (`funding_uid`),\n
KEY `simulation_state` (`simulation_state`),\n
KEY `resource_node_uid` (`resource_uid`, `node_uid`),\n
KEY `resource_section_node_uid` (`resource_uid`, `section_uid`, `node_uid`, `simulation_state`),\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_funding_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.funding_uid
]]></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="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_funding_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.funding_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -36,6 +36,8 @@
<key>resourceType | movement,catalog/portal_type/z_related_resource_from_movement</key>
<key>stock_function_category_strict_membership_uid | category/category_uid/z_related_strict_membership_function_uid_from_stock</key>
<key>stock_function_category_uid | category/category_uid/z_related_function_uid_from_stock</key>
<key>stock_funding_category_strict_membership_uid | category/category_uid/z_related_strict_membership_funding_uid_from_stock</key>
<key>stock_funding_category_uid | category/category_uid/z_related_funding_uid_from_stock</key>
<key>stock_mirror_section_category_strict_membership_uid | category/category_uid/z_related_strict_membership_mirror_section_uid_from_stock</key>
<key>stock_mirror_section_category_uid | category/category_uid/z_related_mirror_section_uid_from_stock</key>
<key>stock_node_category_strict_membership_uid | category/category_uid/z_related_strict_membership_node_uid_from_stock</key>
......@@ -59,4 +61,4 @@
<key>translated_validation_state | translation/translated_message/z_related_translated_validation_state</key>
<key>translated_validation_state_title | translation/translated_message/z_related_translated_validation_state_title</key>
<key>variationCategory | category/category_uid/z_related_uid</key>
</key_list>
\ No newline at end of file
</key_list>
236
\ No newline at end of file
238
\ No newline at end of file
......@@ -142,4 +142,6 @@ erp5_mysql_innodb/z_show_index
erp5_mysql_innodb/z_show_tables
erp5_mysql_innodb/z_uncatalog_delivery
erp5_mysql_innodb/z_uncatalog_object
erp5_mysql_innodb/z_unique_values
\ No newline at end of file
erp5_mysql_innodb/z_unique_values
erp5_mysql_innodb/z_related_funding_uid_from_stock
erp5_mysql_innodb/z_related_strict_membership_funding_uid_from_stock
\ No newline at end of file
......@@ -60,4 +60,6 @@ grand_grand_grand_parent_delivery_portal_type | category,catalog,catalog,catalog
grand_grand_grand_grand_parent_specialise_portal_type | category,catalog,catalog,catalog,catalog,catalog/portal_type/z_related_grand_grand_grand_grand_parent_specialise
grand_grand_grand_grand_parent_specialise_reference | category,catalog,catalog,catalog,catalog,catalog/reference/z_related_grand_grand_grand_grand_parent_specialise
children_reference | catalog/reference/z_related_children
related_resource_from_use_category_uid | category,category/category_uid/z_related_resource_from_use
\ No newline at end of file
related_resource_from_use_category_uid | category,category/category_uid/z_related_resource_from_use
stock_funding_category_strict_membership_uid | category/category_uid/z_related_strict_membership_funding_uid_from_stock
stock_funding_category_uid | category/category_uid/z_related_funding_uid_from_stock
\ No newline at end of file
......@@ -405,7 +405,40 @@ class TestInventory(InventoryAPITestCase):
function_category_strict_membership='function/function1')
self.assertInventoryEquals(100,
function_category_strict_membership='function/function1/function2')
def test_Funding(self):
"""Tests inventory on funding"""
self._makeMovement(quantity=30, destination_funding='function/function1')
self._makeMovement(quantity=-70, source_funding='function/function1')
self.assertInventoryEquals(100, funding='function/function1')
self.assertInventoryEquals(0, funding='function/function1/function2')
def test_FundingUid(self):
"""Tests inventory on funding uid"""
function = self.portal.portal_categories.function
self._makeMovement(quantity=100, destination_funding='function/function1')
self.assertInventoryEquals(100, funding_uid=function.function1.getUid())
self.assertInventoryEquals(0,
funding_uid=function.function1.function2.getUid())
def test_FundingCategory(self):
"""Tests inventory on funding category"""
self._makeMovement(quantity=100,
destination_funding='function/function1/function2')
self.assertInventoryEquals(100, funding_category='function/function1')
self.assertInventoryEquals(100, funding='function/function1/function2')
def test_FundingCategoryStrictMembership(self):
"""Tests inventory on funding category strict membership"""
self._makeMovement(quantity=100,
destination_funding='function/function1/function2')
self.assertInventoryEquals(0,
funding_category_strict_membership='function/function1')
self.assertInventoryEquals(100,
funding_category_strict_membership='function/function1/function2')
def test_Project(self):
"""Tests inventory on project"""
self._makeMovement(quantity=100, destination_project_value=self.project)
......@@ -819,6 +852,25 @@ class TestInventoryList(InventoryAPITestCase):
self.assertEquals([r for r in inventory_list if r.function_uid ==
function2.getUid()][0].inventory, 3)
def test_GroupByFunding(self):
getInventoryList = self.getSimulationTool().getInventoryList
funding1 = self.portal.portal_categories.restrictedTraverse(
'function/function1')
funding2 = self.portal.portal_categories.restrictedTraverse(
'function/function1/function2')
self._makeMovement(quantity=2,
destination_funding_value=funding1,)
self._makeMovement(quantity=3,
destination_funding_value=funding2,)
inventory_list = getInventoryList(node_uid=self.node.getUid(),
group_by_funding=1)
self.assertEquals(2, len(inventory_list))
self.assertEquals([r for r in inventory_list if r.funding_uid ==
funding1.getUid()][0].inventory, 2)
self.assertEquals([r for r in inventory_list if r.funding_uid ==
funding2.getUid()][0].inventory, 3)
def test_GroupByProject(self):
getInventoryList = self.getSimulationTool().getInventoryList
self._makeMovement(quantity=2,
......@@ -1276,7 +1328,23 @@ class TestMovementHistoryList(InventoryAPITestCase):
self.assertEquals('MovementHistoryListBrain', brain_class,
"unexpected brain class for getMovementHistoryList InventoryListBrain"
" != %s (bases %s)" % (brain_class, r_bases))
def testBrainAttribute(self):
"""Test attributes exposed on brains."""
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
self._makeMovement(quantity=100)
brain = getMovementHistoryList()[0]
self.assertTrue(hasattr(brain, 'node_uid'))
self.assertTrue(hasattr(brain, 'resource_uid'))
self.assertTrue(hasattr(brain, 'section_uid'))
self.assertTrue(hasattr(brain, 'date'))
self.assertTrue(hasattr(brain, 'function_uid'))
self.assertTrue(hasattr(brain, 'payment_uid'))
self.assertTrue(hasattr(brain, 'project_uid'))
self.assertTrue(hasattr(brain, 'funding_uid'))
self.assertTrue(hasattr(brain, 'mirror_node_uid'))
self.assertTrue(hasattr(brain, 'mirror_section_uid'))
def testSection(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
mvt = self._makeMovement(quantity=100)
......
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