Commit 392161f2 authored by Vincent Pelletier's avatar Vincent Pelletier

PaymentTransactionGroup_statPaymentTransactionLineList: Do not use node_category.

node_category adds a join with catalog which tends to be preferred by query
optimiser over the agrgegate relation (because there are fewer accounts than
there are aggregared documents), which makes displaying a payment group
proportional to the number of payments on the accoutns instead of
proportional to current group's related aggregate list.
Also, drop parent_portal_type condition, as payment lines aggregated to a
group should be children of a Payment Transaction (and it saves one more
join - although much less costly than the node_category one).
Also, make aggregate relation condition strict (there should be no group
sub-objects from which we would want to get related aggregates).
parent ccb1c811
...@@ -2,10 +2,12 @@ from Products.PythonScripts.standard import Object ...@@ -2,10 +2,12 @@ from Products.PythonScripts.standard import Object
portal = context.getPortalObject() portal = context.getPortalObject()
kw.update({ kw.update({
'parent_portal_type':'Payment Transaction', 'section_uid': context.getSourceSectionUid(),
'section_uid':context.getSourceSectionUid(), 'strict_aggregate_uid': context.getUid(),
'default_aggregate_uid':context.getUid(), 'node_uid': [x.uid for x in portal.portal_catalog(
'node_category':'account_type/asset/cash/bank', portal_type='Account',
strict_account_type_uid=portal.portal_categories.account_type.asset.cash.bank.getUid(),
)],
}) })
return Object(total_quantity=portal.portal_simulation.getInventory(**kw)), return Object(total_quantity=portal.portal_simulation.getInventory(**kw)),
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