Commit fe70a1cf authored by Nicolas Dumazet's avatar Nicolas Dumazet

Extend zGetInventoryList to retrieve transformed inventories


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33210 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3a3743bd
......@@ -165,6 +165,18 @@
</dictionary>
</value>
</item>
<item>
<key> <string>transformed_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>transformed_variation_text</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>where_expression</string> </key>
<value>
......@@ -198,6 +210,8 @@
<string>convert_quantity_result</string>
<string>quantity_unit_uid</string>
<string>stock_table_id</string>
<string>transformed_uid</string>
<string>transformed_variation_text</string>
</list>
</value>
</item>
......@@ -233,7 +247,9 @@ inventory_list\r\n
statistic\r\n
convert_quantity_result\r\n
quantity_unit_uid\r\n
stock_table_id=stock</string> </value>
stock_table_id=stock\r\n
transformed_uid\r\n
transformed_variation_text</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -275,20 +291,24 @@ stock_table_id=stock</string> </value>
SELECT\n
<dtml-if expr="precision is not None">\n
SUM(ROUND(<dtml-var stock_table_id>.quantity, <dtml-var precision>)) AS inventory,\n
SUM(ROUND(<dtml-var stock_table_id>.quantity, <dtml-var precision>)) AS total_quantity,\n
SUM(ROUND(<dtml-var stock_table_id>.quantity\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>, <dtml-var precision>)) AS inventory,\n
SUM(ROUND(<dtml-var stock_table_id>.quantity\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>, <dtml-var precision>)) AS total_quantity,\n
<dtml-if convert_quantity_result>\n
SUM(ROUND(<dtml-var stock_table_id>.quantity * measure.quantity \n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>, <dtml-var precision>))\n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>, <dtml-var precision>))\n
AS converted_quantity,\n
</dtml-if>\n
SUM(ROUND(<dtml-var stock_table_id>.total_price, <dtml-var precision>)) AS total_price\n
<dtml-else>\n
SUM(<dtml-var stock_table_id>.quantity) AS inventory,\n
SUM(<dtml-var stock_table_id>.quantity) AS total_quantity,\n
SUM(<dtml-var stock_table_id>.quantity <dtml-if transformed_uid> * transformation.quantity</dtml-if>) AS inventory,\n
SUM(<dtml-var stock_table_id>.quantity <dtml-if transformed_uid> * transformation.quantity</dtml-if>) AS total_quantity,\n
<dtml-if convert_quantity_result>\n
ROUND(SUM(<dtml-var stock_table_id>.quantity * measure.quantity\n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>), 12)\n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>), 12)\n
AS converted_quantity,\n
</dtml-if>\n
SUM(<dtml-var stock_table_id>.total_price) AS total_price\n
......@@ -302,9 +322,15 @@ SELECT\n
section.relative_url AS section_relative_url,\n
resource.title AS resource_title,\n
resource.relative_url AS resource_relative_url,\n
<dtml-if transformed_uid>\n
transformed_resource.title AS transformed_resource_title,\n
transformed_resource.relative_url AS transformed_resource_relative_url,\n
transformation.transformed_uid AS transformed_resource_uid,\n
transformation.transformed_variation_text AS transformed_variation_text,\n
</dtml-if>\n
<dtml-var stock_table_id>.resource_uid AS resource_uid,\n
<dtml-var stock_table_id>.variation_text AS variation_text,\n
<dtml-var stock_table_id>.sub_variation_text AS sub_variation_text,\n
<dtml-var stock_table_id>.resource_uid AS resource_uid,\n
<dtml-var stock_table_id>.uid AS stock_uid,\n
<dtml-var stock_table_id>.date as date,\n
<dtml-var stock_table_id>.simulation_state as simulation_state,\n
......@@ -346,7 +372,7 @@ FROM\n
</dtml-in>\n
<dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n
, catalog as node, catalog as resource <dtml-if transformed_uid>, transformation, catalog as transformed_resource</dtml-if>\n
\n
WHERE\n
<dtml-var stock_table_id>.uid = catalog.uid\n
......@@ -355,7 +381,20 @@ WHERE\n
</dtml-if>\n
\n
AND node.uid = <dtml-var stock_table_id>.node_uid\n
\n
<dtml-if transformed_uid>\n
AND transformation.uid = <dtml-var stock_table_id>.resource_uid\n
AND resource.uid = transformation.uid\n
AND <dtml-var stock_table_id>.variation_text = transformation.variation_text\n
\n
AND transformed_resource.uid = transformation.transformed_uid\n
AND <dtml-sqltest transformed_uid column="transformation.transformed_uid" type=int multiple>\n
<dtml-if transformed_variation_text>\n
AND <dtml-sqltest transformed_variation_text column="transformation.transformed_variation_text" type=string>\n
</dtml-if>\n
<dtml-else>\n
AND resource.uid = <dtml-var stock_table_id>.resource_uid\n
</dtml-if>\n
\n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
......@@ -375,6 +414,7 @@ WHERE\n
\n
<dtml-if group_by_expression>\n
GROUP BY\n
<dtml-if transformed_uid>transformation.transformed_uid,</dtml-if>\n
<dtml-var group_by_expression>\n
</dtml-if>\n
<dtml-if order_by_expression>\n
......@@ -423,20 +463,24 @@ ORDER BY\n
SELECT\n
<dtml-if expr="precision is not None">\n
SUM(ROUND(<dtml-var stock_table_id>.quantity, <dtml-var precision>)) AS inventory,\n
SUM(ROUND(<dtml-var stock_table_id>.quantity, <dtml-var precision>)) AS total_quantity,\n
SUM(ROUND(<dtml-var stock_table_id>.quantity\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>, <dtml-var precision>)) AS inventory,\n
SUM(ROUND(<dtml-var stock_table_id>.quantity\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>, <dtml-var precision>)) AS total_quantity,\n
<dtml-if convert_quantity_result>\n
SUM(ROUND(<dtml-var stock_table_id>.quantity * measure.quantity \n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>, <dtml-var precision>))\n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>, <dtml-var precision>))\n
AS converted_quantity,\n
</dtml-if>\n
SUM(ROUND(<dtml-var stock_table_id>.total_price, <dtml-var precision>)) AS total_price\n
<dtml-else>\n
SUM(<dtml-var stock_table_id>.quantity) AS inventory,\n
SUM(<dtml-var stock_table_id>.quantity) AS total_quantity,\n
SUM(<dtml-var stock_table_id>.quantity <dtml-if transformed_uid> * transformation.quantity</dtml-if>) AS inventory,\n
SUM(<dtml-var stock_table_id>.quantity <dtml-if transformed_uid> * transformation.quantity</dtml-if>) AS total_quantity,\n
<dtml-if convert_quantity_result>\n
ROUND(SUM(<dtml-var stock_table_id>.quantity * measure.quantity\n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>), 12)\n
<dtml-if quantity_unit_uid> / quantity_unit_conversion.quantity</dtml-if>\n
<dtml-if transformed_uid> * transformation.quantity</dtml-if>), 12)\n
AS converted_quantity,\n
</dtml-if>\n
SUM(<dtml-var stock_table_id>.total_price) AS total_price\n
......@@ -450,9 +494,15 @@ SELECT\n
section.relative_url AS section_relative_url,\n
resource.title AS resource_title,\n
resource.relative_url AS resource_relative_url,\n
<dtml-if transformed_uid>\n
transformed_resource.title AS transformed_resource_title,\n
transformed_resource.relative_url AS transformed_resource_relative_url,\n
transformation.transformed_uid AS transformed_resource_uid,\n
transformation.transformed_variation_text AS transformed_variation_text,\n
</dtml-if>\n
<dtml-var stock_table_id>.resource_uid AS resource_uid,\n
<dtml-var stock_table_id>.variation_text AS variation_text,\n
<dtml-var stock_table_id>.sub_variation_text AS sub_variation_text,\n
<dtml-var stock_table_id>.resource_uid AS resource_uid,\n
<dtml-var stock_table_id>.uid AS stock_uid,\n
<dtml-var stock_table_id>.date as date,\n
<dtml-var stock_table_id>.simulation_state as simulation_state,\n
......@@ -494,7 +544,7 @@ FROM\n
</dtml-in>\n
<dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n
, catalog as node, catalog as resource <dtml-if transformed_uid>, transformation, catalog as transformed_resource</dtml-if>\n
\n
WHERE\n
<dtml-var stock_table_id>.uid = catalog.uid\n
......@@ -503,7 +553,20 @@ WHERE\n
</dtml-if>\n
\n
AND node.uid = <dtml-var stock_table_id>.node_uid\n
\n
<dtml-if transformed_uid>\n
AND transformation.uid = <dtml-var stock_table_id>.resource_uid\n
AND resource.uid = transformation.uid\n
AND <dtml-var stock_table_id>.variation_text = transformation.variation_text\n
\n
AND transformed_resource.uid = transformation.transformed_uid\n
AND <dtml-sqltest transformed_uid column="transformation.transformed_uid" type=int multiple>\n
<dtml-if transformed_variation_text>\n
AND <dtml-sqltest transformed_variation_text column="transformation.transformed_variation_text" type=string>\n
</dtml-if>\n
<dtml-else>\n
AND resource.uid = <dtml-var stock_table_id>.resource_uid\n
</dtml-if>\n
\n
<dtml-if omit_simulation>\n
AND catalog.portal_type != \'Simulation Movement\'\n
......@@ -523,6 +586,7 @@ WHERE\n
\n
<dtml-if group_by_expression>\n
GROUP BY\n
<dtml-if transformed_uid>transformation.transformed_uid,</dtml-if>\n
<dtml-var group_by_expression>\n
</dtml-if>\n
<dtml-if order_by_expression>\n
......
2010-03-02 nicolas.dumazet
* Extend zGetInventoryList to also retrieve transformed inventory
2010-02-09 yo
* Add a new field, my_base_unit_price, into Base_viewFieldLibrary.
......
1491
\ No newline at end of file
1492
\ No newline at end of file
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