diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountingTransactionCount.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountingTransactionCount.xml
index b165c872ead82769f8ef40dc950d4d4b4a13a313..a7f3aec193e1d4f2c5643a6ee7e9e6491236ce43 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountingTransactionCount.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountingTransactionCount.xml
@@ -55,10 +55,6 @@
             <key> <string>_body</string> </key>
             <value> <string>kwd = context.ERP5Accounting_getParams(selection_name)\n
 \n
-# XXX missing :(\n
-# this may fail if we have movements on something else than accounts\n
-#kwd[\'where_expression\'] = \'node.parent_uid = %s\' context.account_module.getUid()\n
-\n
 if kw.get(\'stat\'):\n
   selection_params = context.portal_selections.getSelectionParamsFor(selection_name)\n
   selection_domain = context.portal_selections.getSelectionDomainDictFor(selection_name)\n
@@ -79,6 +75,8 @@ if kw.get(\'stat\'):\n
     # if yes, apply the same filter here\n
     kwd[\'stock.node_uid\'] = [x.uid for x in\n
                          context.portal_catalog(**selection_params)]\n
+  else:\n
+    kwd[\'portal_type\'] = context.getPortalAccountingMovementTypeList()\n
   return context.portal_simulation.getInventoryStat( **kwd )[0][\'stock_uid\']\n
 \n
 kwd[\'stock.node_uid\'] = brain.uid\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index cb225603316a1950cb97a32db5bb5c9e7a44618b..7bed0227374ae83cc50da61fd773b5770ea2c733 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-827
\ No newline at end of file
+828
\ No newline at end of file