Commit 7cb7f59e authored by Łukasz Nowak's avatar Łukasz Nowak

Implement simple builders for Sale Packing Lists.

Requirements for builders:

 * simulation only from trade_phase and business process
 * only is_buildable

causality_uid passed by Business Path build method satisfies the first
requirement, and it is passed to VifibDeliveryBuilder_selectMovement in **kw.

is_buildable is checked later in build process.
parent 767ee613
......@@ -106,7 +106,6 @@
<string>trade_phase/vifib/delivery</string>
<string>predecessor/trade_state/ordered</string>
<string>successor/trade_state/delivered</string>
<string>delivery_builder/portal_deliveries/hosting_subscription_sale_packing_list_builder</string>
<string>delivery_builder/portal_deliveries/vifib_sale_packing_list_builder</string>
</tuple>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Delivery Builder" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>collect_order</string> </key>
<value>
<tuple>
<string>OrderMovementGroup</string>
<string>PathMovementGroup</string>
<string>DateMovementGroup</string>
<string>ResourceMovementGroup</string>
<string>VariantMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>collect_order_list</string> </key>
<value>
<list>
<string>test</string>
<string>test2</string>
</list>
</value>
</item>
<item>
<key> <string>collect_order_list_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delivery_after_generation_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>HostingSubscriptionSalePackingList_copyProperties</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
<value>
<tuple>
<string>VariantMovementGroup</string>
<string>CausalityAssignmentMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_cell_portal_type</string> </key>
<value> <string>Sale Packing List Cell</string> </value>
</item>
<item>
<key> <string>delivery_cell_separate_order</string> </key>
<value>
<tuple>
<string>calculateAveragePrice</string>
<string>calculateAddQuantity</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_collect_order</string> </key>
<value>
<tuple>
<string>OrderMovementGroup</string>
<string>DateMovementGroup</string>
<string>PathMovementGroup</string>
<string>SectionPathMovementGroup</string>
<string>PriceCurrencyMovementGroup</string>
<string>DecisionPathMovementGroup</string>
<string>AdministrationPathMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_line_collect_order</string> </key>
<value>
<tuple>
<string>ResourceMovementGroup</string>
<string>BaseVariantMovementGroup</string>
<string>AggregateMovementGroup</string>
<string>CausalityAssignmentMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_line_portal_type</string> </key>
<value> <string>Sale Packing List Line</string> </value>
</item>
<item>
<key> <string>delivery_module</string> </key>
<value> <string>sale_packing_list_module</string> </value>
</item>
<item>
<key> <string>delivery_portal_type</string> </key>
<value> <string>Sale Packing List</string> </value>
</item>
<item>
<key> <string>delivery_select_method_id</string> </key>
<value> <string>DeliveryBuilder_selectConfirmedDeliveryList</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hosting_subscription_sale_packing_list_builder</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Delivery Builder</string> </value>
</item>
<item>
<key> <string>resource_portal_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>HostingSubscription_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Vifib Instance Hosting Sale Packing List Builder</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Variant Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>base_variant_movement_group_in_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Variant Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>base_variant_movement_group_in_line</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/category</string>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>delivery_mode</string>
<string>incoterm</string>
<string>source</string>
<string>destination</string>
<string>source_section</string>
<string>destination_section</string>
<string>source_decision</string>
<string>destination_decision</string>
<string>source_administration</string>
<string>destination_administration</string>
<string>source_project</string>
<string>destination_project</string>
<string>source_payment</string>
<string>destination_payment</string>
<string>price_currency</string>
<string>specialise</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/category</string>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>category_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>resource</string>
<string>aggregate</string>
<string>base_application</string>
<string>base_contribution</string>
<string>quantity_unit</string>
<string>source_account</string>
<string>destination_account</string>
<string>source_function</string>
<string>destination_function</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>category_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Causality Assignment Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/cell</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>causality_assignment_movement_group_on_cell</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Causality Assignment Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>causality_assignment_movement_group_on_cell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Causality Assignment Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>causality_assignment_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Causality Assignment Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>causality_assignment_movement_group_on_line</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Order Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>order_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Order Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>order_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>start_date</string>
<string>stop_date</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>description</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variant Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/cell</string>
<string>divergence_scope/category</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variant_movement_group_on_cell</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Variant Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>variant_movement_group_on_cell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -65,7 +65,7 @@
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>SalePackingList_copyOrderProperties</string> </value>
<value> <string>VifibSalePackingList_postGeneration</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
......@@ -152,7 +152,7 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>SaleOrder_selectMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -320,32 +320,14 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getClosestDate\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
kw[\'query\'] = Query(portal_type=\'Simulation Movement\',\n
parent_specialise_portal_type=\'Subscription Item Root Simulation Rule\',\n
simulation_state=\'planned\', causality_state=\'expanded\')\n
\n
build_before = kw.get(\'build_before\', None)\n
if build_before is None:\n
build_before = getClosestDate(target_date=DateTime(), precision=\'month\', before=0)\n
<value> <string># XXX: re-support build_before\n
\n
if src__==0:\n
candidate_list = [x.getObject() for x in context.portal_catalog(**kw)]\n
movement_list = []\n
for x in candidate_list:\n
if x.getStartDate() < build_before:\n
movement_list.append(x)\n
movement_list = context.portal_catalog(**kw)\n
return movement_list\n
else:\n
return context.portal_catalog(src__=1, **kw)\n
]]></string> </value>
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......@@ -353,7 +335,7 @@ else:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_selectMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -57,18 +57,18 @@ from Products.ERP5Type.Message import translateString\n
\n
packing_list = context\n
\n
try:\n
packing_list.PackingList_copyOrderProperties()\n
except AttributeError:\n
# does not come from Order\n
pass\n
\n
# Then, modify state\n
confirm_tag = \'%s_confirm\' % packing_list.getPath()\n
packing_list.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
tag=confirm_tag).Delivery_confirm()\n
\n
# # Start delivery\n
# start_tag = \'%s_start\' % packing_list.getPath()\n
# packing_list.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
# (\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
# tag=start_tag, after_tag=confirm_tag).Delivery_startConfirmedSalePackingList()\n
\n
# First set the packing_list in the building state\n
packing_list.startBuilding()\n
# Then an activity should put the causality state in diverged or solved\n
......@@ -83,7 +83,7 @@ packing_list.activate(after_path_and_method_id=(related_simulation_movement_path
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscriptionSalePackingList_copyProperties</string> </value>
<value> <string>VifibSalePackingList_postGeneration</string> </value>
</item>
</dictionary>
</pickle>
......
58
\ No newline at end of file
59
\ No newline at end of file
......@@ -16,8 +16,6 @@ business_process_module/vifib_sale_business_process/**
portal_categories/trade_phase/vifib
portal_categories/trade_phase/vifib/**
portal_categories/trade_state/**
portal_deliveries/hosting_subscription_sale_packing_list_builder
portal_deliveries/hosting_subscription_sale_packing_list_builder/**
portal_deliveries/vifib_payment_transaction_builder
portal_deliveries/vifib_payment_transaction_builder/**
portal_deliveries/vifib_purchase_packing_list_builder
......
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