Commit 50844f12 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_pdm_ui_test: support Purchase and Internal deliveries too

parent 1b23822a
from DateTime import DateTime
portal = context.getPortalObject()
order_portal_type = "Sale Order"
order_line_portal_type = "Sale Order Line"
delivery_portal_type = "Sale Packing List"
delivery_line_portal_type = "Sale Packing List Line"
order_portal_type = "%s Order" % delivery_type
order_line_portal_type = "%s Order Line" % delivery_type
delivery_portal_type = "%s Packing List" % delivery_type
delivery_line_portal_type = "%s Packing List Line" % delivery_type
delivery_id = "erp5_pdm_ui_test_delivery"
delivery_title = "erp5_pdm_ui_test_delivery_title"
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state</string> </value>
<value> <string>state, delivery_type="Sale"</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -4,9 +4,6 @@ resource_portal_type = "Product"
node_portal_type = "Organisation"
site_portal_type = "Category"
order_portal_type = "Sale Order"
delivery_portal_type = "Sale Packing List"
resource_id = "erp5_pdm_ui_test_product"
source_node_id = "erp5_pdm_ui_test_source_node"
......@@ -35,18 +32,22 @@ for site_id in (source_site_id, destination_site_id):
base_category.manage_delObjects([site_id])
stool = portal.portal_simulation
# Delete order
module = portal.getDefaultModule(order_portal_type)
if getattr(module, delivery_id, None) is not None:
delivery = getattr(module, delivery_id)
stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule'))
module.manage_delObjects([delivery_id])
# Delete delivery
module = portal.getDefaultModule(delivery_portal_type)
if getattr(module, delivery_id, None) is not None:
delivery = getattr(module, delivery_id)
stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule'))
module.manage_delObjects([delivery_id])
for delivery_type in ("Internal", "Purchase", "Sale"):
order_portal_type = delivery_type + " Order"
delivery_portal_type = delivery_type + " Packing List"
# Delete order
module = portal.getDefaultModule(order_portal_type)
if getattr(module, delivery_id, None) is not None:
delivery = getattr(module, delivery_id)
stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule'))
module.manage_delObjects([delivery_id])
# Delete delivery
module = portal.getDefaultModule(delivery_portal_type)
if getattr(module, delivery_id, None) is not None:
delivery = getattr(module, delivery_id)
stool.manage_delObjects(delivery.getCausalityRelatedIdList(portal_type='Applied Rule'))
module.manage_delObjects([delivery_id])
return "Deleted Successfully."
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