Commit f6935cb8 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_banking_check: More *_expression removal

Add dependency on erp5_item to get now-required related keys.
parent 6bb4c56e
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Message import Message from Products.ERP5Type.Message import Message
aggregate_uid_list = [x.uid for x in context.portal_simulation.getCurrentTrackingList( aggregate_uid_list = [
at_date=at_date, node=node_url, x.uid for x in context.portal_simulation.getCurrentTrackingList(
where_expression="item_catalog.portal_type IN ('Check', 'Checkbook')")] at_date=at_date,
node=node_url,
item_catalog_portal_type=('Check', 'Checkbook'),
)
]
for line in context.getMovementList(): for line in context.getMovementList():
for aggregate_value in line.getAggregateValueList(): for aggregate_value in line.getAggregateValueList():
if aggregate_value.getUid() not in aggregate_uid_list: if aggregate_value.getUid() not in aggregate_uid_list:
......
...@@ -32,11 +32,12 @@ if listbox is None: ...@@ -32,11 +32,12 @@ if listbox is None:
listbox = [] listbox = []
if node is not None or disable_node: if node is not None or disable_node:
getCurrentTrackingList = context.portal_simulation.getCurrentTrackingList getCurrentTrackingList = context.portal_simulation.getCurrentTrackingList
# context.log('Delivery_viewCheckbookInputDialog', getCurrentTrackingList(at_date=at_date, node=node,src__=1,where_expression="item_catalog.portal_type='Check' or item_catalog.portal_type='Checkbook'"))
if disable_node: if disable_node:
node=None node=None
kw = {} kw = {
'item_catalog_portal_type': ('Check', 'Checkbook'),
}
if reference not in (None, ''): if reference not in (None, ''):
kw['aggregate_uid'] = [x.uid for x in context.getPortalObject().portal_catalog( kw['aggregate_uid'] = [x.uid for x in context.getPortalObject().portal_catalog(
destination_payment_internal_bank_account_number=reference, destination_payment_internal_bank_account_number=reference,
...@@ -47,17 +48,12 @@ if listbox is None: ...@@ -47,17 +48,12 @@ if listbox is None:
checkbook_model_uid = context.getPortalObject().restrictedTraverse(checkbook_model).getUid() checkbook_model_uid = context.getPortalObject().restrictedTraverse(checkbook_model).getUid()
kw['resource_uid'] = checkbook_model_uid kw['resource_uid'] = checkbook_model_uid
search_criterion = ''
if title not in (None, ''): if title not in (None, ''):
# FIXME: this doesn't work with current catalog and simulation tool kw['item_catalog_title'] = title
# build a SQL statement to bypass this limitation
#kw['item_catalog.title'] = title
search_criterion = " AND item_catalog.title LIKE '%s'" % title
current_tracking_list = getCurrentTrackingList( current_tracking_list = getCurrentTrackingList(
to_date=at_date, to_date=at_date,
node=node, node=node,
where_expression="item_catalog.portal_type='Check' or item_catalog.portal_type='Checkbook' %s" % search_criterion,
**kw) **kw)
if count is True: if count is True:
......
erp5_banking_core erp5_banking_core
\ No newline at end of file erp5_item
...@@ -54,6 +54,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase): ...@@ -54,6 +54,7 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
'erp5_base', 'erp5_base',
'erp5_pdm', 'erp5_pdm',
'erp5_trade', 'erp5_trade',
'erp5_item',
'erp5_accounting', 'erp5_accounting',
'erp5_banking_core', 'erp5_banking_core',
'erp5_banking_inventory', 'erp5_banking_inventory',
......
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