<dtml-comment>
title:
connection_id:MySQL
max_rows:100000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params></params>
SELECT DISTINCT catalog.relative_url, catalog.id, catalog.path
FROM catalog, catalog AS delivery
LEFT JOIN category ON (catalog.uid=category.category_uid
AND category.base_category_uid = <dtml-var "portal_categories.causality.uid">
AND category.uid = delivery.uid )
WHERE ( catalog.portal_type = "Sales Order"
OR catalog.portal_type = "Purchase Order"
OR catalog.portal_type = "Production Order" )
AND ( delivery.portal_type = "Sales Packing List"
OR delivery.portal_type = "Purchase Packing List"
OR delivery.portal_type = "Production Packing List" )
AND catalog.simulation_state = "confirmed"
AND category.uid IS NULL