Commit 3667d2fb authored by Sebastien Robin's avatar Sebastien Robin

make causality workflow, solvers working for invoice lines

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6347 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 84151ada
......@@ -119,6 +119,7 @@
<string>my_description</string>
<string>my_translated_portal_type</string>
<string>my_translated_simulation_state_title</string>
<string>my_translated_causality_state_title</string>
</list>
</value>
</item>
......
......@@ -66,9 +66,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>explanation = context.getExplanationValue()\n
<value> <string>explanation_value = context.getExplanationValue()\n
if explanation_value is not None:\n
if explanation_value.getPortalType()==\'Purchase Invoice\':\n
if explanation_value.getPortalType().startswith(\'Purchase\'):\n
return 1\n
return 0\n
</string> </value>
......@@ -81,7 +81,7 @@ return 0\n
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/Movement_explanationPortalTypeIsPurchaseInvoice</string> </value>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/Movement_explanationPortalTypeIsPurchase</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
......@@ -120,7 +120,6 @@ return 0\n
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>explanation</string>
<string>explanation_value</string>
<string>None</string>
</tuple>
......@@ -139,7 +138,7 @@ return 0\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Movement_explanationPortalTypeIsPurchaseInvoice</string> </value>
<value> <string>Movement_explanationPortalTypeIsPurchase</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -66,9 +66,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>explanation = context.getExplanationValue()\n
<value> <string>explanation_value = context.getExplanationValue()\n
if explanation_value is not None:\n
if explanation_value.getPortalType()==\'Sale Invoice\':\n
if explanation_value.getPortalType().startswith(\'Sale\'):\n
return 1\n
return 0\n
</string> </value>
......@@ -81,7 +81,7 @@ return 0\n
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/Movement_explanationPortalTypeIsSaleInvoice</string> </value>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/Movement_explanationPortalTypeIsSale</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
......@@ -119,8 +119,7 @@ return 0\n
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>explanation</string>
<string>context</string>
<string>explanation_value</string>
<string>None</string>
</tuple>
......@@ -139,7 +138,7 @@ return 0\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Movement_explanationPortalTypeIsSaleInvoice</string> </value>
<value> <string>Movement_explanationPortalTypeIsSale</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
......
......@@ -69,7 +69,7 @@
<value> <string>packing_list = state_change.object\n
\n
# Create Delivery Applied Rule (if required)\n
packing_list.updateAppliedRule()\n
packing_list.updateAppliedRule(\'default_invoice_rule\')\n
# Make sure applied rule is 100% indexed\n
# Here, applied rule must be already cleanly created \n
\n
......
......@@ -69,7 +69,7 @@
<value> <string>packing_list = state_change.object\n
\n
# Create Delivery Applied Rule (if required)\n
packing_list.updateAppliedRule()\n
packing_list.updateAppliedRule(\'default_invoice_rule\')\n
# Make sure applied rule is 100% indexed\n
# Here, applied rule must be already cleanly created \n
\n
......
......@@ -77,7 +77,7 @@ start_date = state_change.kwargs[\'start_date\']\n
packing_list.portal_workflow.doActionFor(\n
packing_list,\n
\'split_prevision\',\n
wf_id=\'packing_list_causality_workflow\',\n
wf_id=\'invoice_causality_workflow\',\n
start_date=start_date,\n
stop_date=stop_date)\n
</string> </value>
......
......@@ -72,7 +72,7 @@ stop_date = state_change.kwargs[\'stop_date\']\n
start_date = state_change.kwargs[\'start_date\']\n
\n
# Create Delivery Applied Rule (if required)\n
packing_list.updateAppliedRule()\n
packing_list.updateAppliedRule(\'default_invoice_rule\')\n
# Make sure applied rule is 100% indexed\n
# Here, applied rule must be already cleanly created \n
\n
......@@ -88,18 +88,16 @@ packing_list.activate().updateCausalityState()\n
\n
# Create delivery\n
order = packing_list.getCausalityValue()\n
applied_rule = order.getCausalityRelatedValue(portal_type="Applied Rule")\n
# reindex simulation movement as quick as possible\n
#applied_rule.recursiveImmediateReindexObject()\n
\n
order_portal_type = order.getPortalType()\n
if order_portal_type == \'Sale Order\':\n
delivery_builder = order.portal_deliveries.sale_packing_list_builder\n
elif order_portal_type == \'Purchase Order\':\n
delivery_builder = order.portal_deliveries.purchase_packing_list_builder\n
\n
applied_rule_uid = applied_rule.getUid()\n
delivery_builder.activate(activity="SQLQueue",after_method_id=(\'recursiveImmediateReindexObject\',\'immediateReindexObject\')).build(applied_rule_uid=applied_rule_uid)\n
if packing_list.getPortalType()==\'Purchase Invoice Transaction\':\n
builder_list = (\'purchase_invoice_builder\',\'purchase_invoice_transaction_builder\') \n
elif packing_list.getPortalType()==\'Sale Invoice Transaction\':\n
builder_list = (\'sale_invoice_builder\',\'sale_invoice_transaction_builder\')\n
\n
for builder in builder_list:\n
delivery_builder = order.portal_deliveries[builder]\n
delivery_builder.activate(activity="SQLQueue",after_method_id=(\'recursiveImmediateReindexObject\',\'immediateReindexObject\')).build()\n
</string> </value>
</item>
<item>
......@@ -154,10 +152,10 @@ delivery_builder.activate(activity="SQLQueue",after_method_id=(\'recursiveImmedi
<string>start_date</string>
<string>None</string>
<string>order</string>
<string>applied_rule</string>
<string>order_portal_type</string>
<string>builder_list</string>
<string>_getiter_</string>
<string>builder</string>
<string>delivery_builder</string>
<string>applied_rule_uid</string>
</tuple>
</value>
</item>
......
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