[Erp5-report] r21252 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: CategoryTemplateIt...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri May 30 17:07:32 CEST 2008
Author: jm
Date: Fri May 30 17:07:32 2008
New Revision: 21252
URL: http://svn.erp5.org?rev=21252&view=rev
Log:
* Add support for unit conversion:
* resources are described using Measure objects
* stock can be queried in any unit
* movements perform unit conversion
* See following wiki articles:
* HowToUseMeasures
* TechnicalNotesOnUnitConversion
Added:
erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view/my_quantity.xml
Modified:
erp5/trunk/products/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/quantity_unit.xml
erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view.xml
erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/quantity_unit.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/quantity_unit.xml?rev=21252&r1=21251&r2=21252&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/quantity_unit.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/CategoryTemplateItem/portal_categories/quantity_unit.xml Fri May 30 17:07:32 2008
@@ -45,9 +45,9 @@
<value>
<tuple>
<string>delivery</string>
- <string>resource</string>
<string>order</string>
<string>parent</string>
+ <string>resource</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view.xml?rev=21252&r1=21251&r2=21252&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view.xml Fri May 30 17:07:32 2008
@@ -121,6 +121,7 @@
<string>my_codification</string>
<string>my_int_index</string>
<string>my_translated_validation_state_title</string>
+ <string>my_quantity</string>
</list>
</value>
</item>
Added: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view/my_quantity.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view/my_quantity.xml?rev=21252&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view/my_quantity.xml (added)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Category_view/my_quantity.xml Fri May 30 17:07:32 2008
@@ -1,0 +1,163 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>delegated_list</string> </key>
+ <value>
+ <list>
+ <string>display_width</string>
+ <string>precision</string>
+ <string>enabled</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>my_quantity</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>display_width</string> </key>
+ <value>
+ <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+ </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value>
+ <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+ </value>
+ </item>
+ <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>precision</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>display_width</string> </key>
+ <value> <int>20</int> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string>my_quantity</string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string>Base_viewFieldLibrary</string> </value>
+ </item>
+ <item>
+ <key> <string>precision</string> </key>
+ <value> <int>15</int> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string>Click to edit the target</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+ <record id="2" aka="AAAAAAAAAAI=">
+ <pickle>
+ <tuple>
+ <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>_text</string> </key>
+ <value> <string>python: max(15,int(field.getTemplateField().get_value(\'display_width\')))</string> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+ <record id="3" aka="AAAAAAAAAAM=">
+ <pickle>
+ <tuple>
+ <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>_text</string> </key>
+ <value> <string>python: (lambda x: x.getPortalType() == \'Base Category\' and x.getId() == \'quantity_unit\')(here.getParent().getParent())</string> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml?rev=21252&r1=21251&r2=21252&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml Fri May 30 17:07:32 2008
@@ -114,6 +114,12 @@
</item>
<item>
<key> <string>precision</string> </key>
+ <value>
+ <dictionary/>
+ </value>
+ </item>
+ <item>
+ <key> <string>quantity_unit</string> </key>
<value>
<dictionary/>
</value>
@@ -189,6 +195,7 @@
<string>precision</string>
<string>inventory_list</string>
<string>statistic</string>
+<string>quantity_unit</string>
<string>stock_table_id</string>
</list>
</value>
@@ -196,6 +203,12 @@
</dictionary>
</state>
</object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
</value>
</item>
<item>
@@ -223,6 +236,7 @@
precision\r\n
inventory_list\r\n
statistic\r\n
+quantity_unit\r\n
stock_table_id=stock</string> </value>
</item>
<item>
@@ -267,10 +281,18 @@
<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
+<dtml-if quantity_unit>\n
+ SUM(ROUND(<dtml-var stock_table_id>.quantity * measure.quantity, <dtml-var precision>))\n
+ / <dtml-sqlvar quantity_unit type=float> 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
+<dtml-if quantity_unit>\n
+ ROUND(SUM(<dtml-var stock_table_id>.quantity * measure.quantity)\n
+ / <dtml-sqlvar quantity_unit type=float>, 12) AS converted_quantity,\n
+</dtml-if>\n
SUM(<dtml-var stock_table_id>.total_price) AS total_price\n
</dtml-if>\n
<dtml-if inventory_list>\n
@@ -340,6 +362,12 @@
<dtml-if selection_report>\n
AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n
+\n
+<dtml-if quantity_unit>\n
+ AND concat(<dtml-var stock_table_id>.variation_text,\'\\n\') REGEXP measure.variation\n
+</dtml-if>\n
+\n
+\n
<dtml-if group_by_expression>\n
GROUP BY\n
<dtml-var group_by_expression>\n
@@ -392,10 +420,18 @@
<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
+<dtml-if quantity_unit>\n
+ SUM(ROUND(<dtml-var stock_table_id>.quantity * measure.quantity, <dtml-var precision>))\n
+ / <dtml-sqlvar quantity_unit type=float> 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
+<dtml-if quantity_unit>\n
+ ROUND(SUM(<dtml-var stock_table_id>.quantity * measure.quantity)\n
+ / <dtml-sqlvar quantity_unit type=float>, 12) AS converted_quantity,\n
+</dtml-if>\n
SUM(<dtml-var stock_table_id>.total_price) AS total_price\n
</dtml-if>\n
<dtml-if inventory_list>\n
@@ -465,6 +501,12 @@
<dtml-if selection_report>\n
AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n
+\n
+<dtml-if quantity_unit>\n
+ AND concat(<dtml-var stock_table_id>.variation_text,\'\\n\') REGEXP measure.variation\n
+</dtml-if>\n
+\n
+\n
<dtml-if group_by_expression>\n
GROUP BY\n
<dtml-var group_by_expression>\n
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=21252&r1=21251&r2=21252&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Fri May 30 17:07:32 2008
@@ -1,1 +1,1 @@
-825
+826
More information about the Erp5-report
mailing list