diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Sale%20Order%20Module/workflow_report.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Sale%20Order%20Module/workflow_report.xml
index 7fc2fe6d6180168acc0d5a1919943f7393ffd0eb..959271bc7cd42ab94be1279ed000a4410b10212f 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Sale%20Order%20Module/workflow_report.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Sale%20Order%20Module/workflow_report.xml
@@ -50,7 +50,7 @@
         </item>
         <item>
             <key> <string>priority</string> </key>
-            <value> <float>8.0</float> </value>
+            <value> <float>12.0</float> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportSectionList.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportSectionList.xml
index 00f48616a5536ec9aef8d34770ae8856ae498779..2ce784d55524fe6dbceb83530377714d65c759bc 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportSectionList.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderReportSectionList.xml
@@ -61,6 +61,7 @@ aggregation_level = request.get(\'aggregation_level\')\n
 from_date = request.get(\'from_date\')\n
 to_date = request.get(\'at_date\')\n
 group_by = request.get(\'group_by\')\n
+quantity_unit = request.get(\'quantity_unit\')\n
 simulation_state = request.get(\'simulation_state\', ())\n
 \n
 # define some parameter dependings on module\n
@@ -126,12 +127,17 @@ else:\n
   if group_by == "product":\n
     selection_columns = [(\'product\', "Product")]\n
     stat_columns = [(\'product\', "product")]\n
+  elif group_by == "function":\n
+    function_title = context.AccountingTransactionLine_getFunctionBaseCategoryTitle()\n
+    selection_columns = [(\'product\', function_title)]\n
+    stat_columns = [(\'product\', "product")]\n
   else:\n
     selection_columns = [(\'client\', "Client"), (\'product\', "Product")]\n
     stat_columns = [(\'client\', "client"), (\'product\', "product")]\n
   for x in interval_list:\n
-    interval_column_list.extend([("Amount %s" %x,"Amount %s" %x), ("Quantity %s" %x,"Quantity %s" %x),\n
-                                 ("Quantity Unit %s" %x,"Quantity Unit %s" %x)])\n
+    interval_column_list.extend([("Amount %s" %x,"Amount %s" %x), ("Quantity %s" %x,"Quantity %s" %x)])\n
+    if not quantity_unit:\n
+      interval_column_list.extend([("Quantity Unit %s" %x,"Quantity Unit %s" %x)])\n
   total_column_list = [(\'total amount\', \'Total Amount\'),(\'total quantity\', \'Total Quantity\')]\n
   total_stat_list = [(\'total amount\', \'total amount\'),(\'total quantity\', \'total quantity\')]\n
 \n
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.xml
index a6da2f24a75c3a09df707ce004781f748bb93bd3..28122ca9042c0eb44d28c2e48593a64bf56eca66 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.xml
@@ -63,6 +63,7 @@ from_date = request.get(\'from_date\', None)\n
 to_date = request.get(\'at_date\', None)\n
 aggregation_level = request.get(\'aggregation_level\', None)\n
 report_group_by = request.get(\'group_by\', None)\n
+quantity_unit = request.get(\'quantity_unit\', None)\n
 # get all category\n
 incoterm = request.get(\'incoterm\', None)\n
 section_category = request.get(\'section_category\', None)\n
@@ -163,8 +164,18 @@ for result in result_list:\n
     # client_title -> product_title -> period -> amount/quantity...\n
     # or product_title -> period -> amount/quantity...\n
     for line in result.contentValues(filter = {\'portal_type\':line_portal_type}):\n
+      # Filter by quantity_unit\n
+      if quantity_unit:\n
+        if line.getQuantityUnit() != quantity_unit:\n
+          continue\n
       # FIXME: if two resources have the same title, do we want to group ?\n
-      product_title = line.getResourceTitle()\n
+      if report_group_by == "function":\n
+        if report_type == "sale":\n
+          product_title = line.getSourceFunctionTitle()\n
+        else:\n
+          product_title = line.getDestinationFunctionTitle()\n
+      else:\n
+        product_title = line.getResourceTitle()\n
       if not line_dict.has_key(product_title):\n
         line_dict[product_title] = {period :{"amount" : line.getTotalPrice(),\n
                                              "quantity" : line.getTotalQuantity(),\n
@@ -239,6 +250,12 @@ if len(client_dict):\n
                                                              line_product_dict[product_title][period][\'amount\']\n
               else:\n
                 period_counter_dict[\'Amount %s\' %(period)] = line_product_dict[product_title][period][\'amount\']\n
+              if quantity_unit:\n
+                if period_counter_dict.has_key(\'Quantity %s\' %(period)):\n
+                  period_counter_dict[\'Quantity %s\' %(period)] = period_counter_dict[\'Quantity %s\' %(period)] + \\\n
+                                                               line_product_dict[product_title][period][\'quantity\']\n
+                else:\n
+                  period_counter_dict[\'Quantity %s\' %(period)] = line_product_dict[product_title][period][\'quantity\']\n
               \n
             else:\n
               obj[\'Amount %s\' %(period)] = 0\n
@@ -252,6 +269,11 @@ if len(client_dict):\n
             period_counter_dict[\'total amount\'] = period_counter_dict[\'total amount\'] + line_total_amount\n
           else:\n
             period_counter_dict[\'total amount\'] = line_total_amount\n
+          if quantity_unit:\n
+            if period_counter_dict.has_key(\'total quantity\'):\n
+              period_counter_dict[\'total quantity\'] = period_counter_dict[\'total quantity\'] + line_total_quantity\n
+            else:\n
+              period_counter_dict[\'total quantity\'] = line_total_quantity\n
 \n
           product_lines_list.append(obj)\n
       # sort product list\n
@@ -259,7 +281,7 @@ if len(client_dict):\n
       extend(product_lines_list)\n
 else:\n
   # products\n
-  if report_group_by == "product":\n
+  if report_group_by in ("product", "function"):\n
     for product_title in product_dict.keys():\n
       obj = Object(uid="new_")\n
       obj[\'product\'] = product_title\n
@@ -278,6 +300,11 @@ else:\n
             period_counter_dict[\'Amount %s\' %(period)] = period_counter_dict[\'Amount %s\' %(period)] + product_dict[product_title][period][\'amount\']\n
           else:\n
             period_counter_dict[\'Amount %s\' %(period)] = product_dict[product_title][period][\'amount\']\n
+          if quantity_unit:\n
+            if period_counter_dict.has_key(\'Quantity %s\' %(period)):\n
+              period_counter_dict[\'Quantity %s\' %(period)] = period_counter_dict[\'Quantity %s\' %(period)] + product_dict[product_title][period][\'quantity\']\n
+            else:\n
+              period_counter_dict[\'Quantity %s\' %(period)] = product_dict[product_title][period][\'quantity\']\n
         else:\n
           obj[\'Amount %s\' %(period)] = 0\n
           obj[\'Quantity %s\' %(period)] = 0\n
@@ -290,6 +317,11 @@ else:\n
         period_counter_dict[\'total amount\'] = period_counter_dict[\'total amount\'] + line_total_amount\n
       else:\n
         period_counter_dict[\'total amount\'] = line_total_amount\n
+      if quantity_unit:\n
+        if period_counter_dict.has_key(\'total quantity\'):\n
+          period_counter_dict[\'total quantity\'] = period_counter_dict[\'total quantity\'] + line_total_quantity\n
+        else:\n
+          period_counter_dict[\'total quantity\'] = line_total_quantity\n
       append(obj)\n
 \n
     line_list.sort(sortProduct)\n
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport.xml
index 764b667e90b06cdcc220ad06e0498d77a4d74801..389856fbe20c887d89a840f03270303453cd2c18 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport.xml
@@ -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>
@@ -94,6 +94,7 @@
                         <string>your_delivery_mode</string>
                         <string>your_from_date</string>
                         <string>your_group_by</string>
+                        <string>your_quantity_unit</string>
                         <string>your_incoterm</string>
                         <string>your_order</string>
                         <string>your_section_category</string>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport/your_quantity_unit.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport/your_quantity_unit.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1f02638f58f9b37e606b63c0f60376a34511fc24
--- /dev/null
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReport/your_quantity_unit.xml
@@ -0,0 +1,96 @@
+<?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>
+                <string>title</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>your_quantity_unit</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_dialog_mode_category</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Quantity Unit</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml
index 110e4afdb2f19e67c82ca7b3478147216e94b265..df9936fc4fba7350d460697974312898beed934b 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog.xml
@@ -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>
@@ -114,6 +114,7 @@
                       <list>
                         <string>your_aggregation_level</string>
                         <string>your_group_by</string>
+                        <string>your_quantity_unit</string>
                         <string>your_simulation_state</string>
                       </list>
                     </value>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_quantity_unit.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_quantity_unit.xml
new file mode 100644
index 0000000000000000000000000000000000000000..877d749d96c5971cbd3e2dceeb4bb4961eb54ba9
--- /dev/null
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderReportDialog/your_quantity_unit.xml
@@ -0,0 +1,100 @@
+<?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>
+                <string>title</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>your_quantity_unit</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>
+                <item>
+                    <key> <string>title</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_dialog_mode_category</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Quantity Unit</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderStatList.xml b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderStatList.xml
index c3b61503c71ac045a83da2c2460b5b09abf17176..94026118ae085ea22a74ed03ef806ac9f9d2f6da 100644
--- a/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderStatList.xml
+++ b/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_viewOrderStatList.xml
@@ -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>