Encountered a bug while choosing individual solvers for each Purchase Packing List Line. Looked for it in erp-report archives and did not find any fix for it. The dictionary access was erroneous. Herein is the correction.<br>
Don't know how to get the .xml diff hence submitting it this way.<br><br><table border="1"><tbody><tr><td><pre> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br></pre>
</td>
<td><pre>## Script (Python) "PackingList_doSolveActions"<br>##bind container=container<br>##bind context=context<br>##bind namespace=<br>##bind script=script<br>##bind subpath=traverse_subpath<br>##parameters=form_id, dialog_id='', **kw
<br>##title=<br>##<br>request = context.REQUEST<br><br>listbox = request.get('listbox')<br>start_date = context.getStartDate()<br>stop_date = context.getStopDate()<br>tag = context.getPath() + '_split'<br>
<br>split_and_defer = 0<br><br>if listbox is not None:<br> context.updateAppliedRule("default_delivery_rule")<br></pre></td>
</tr>
<tr>
<td><pre>-<br>+<br>+<br></pre></td>
<td><pre> for line in listbox:<br> for line_key in listbox:<br> line = listbox[line_key]<br></pre></td>
</tr>
<tr>
<td><pre> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br></pre></td>
<td><pre> url = line['listbox_key']<br> quantity = line['quantity']<br> movement = context.restrictedTraverse(url)<br> movement.setProperty('quantity', quantity, type='float')
<br> choice = line['choice'] <br> if choice == 'SplitAndDefer':<br> split_and_defer = 1<br> context.portal_simulation.solveMovement(movement, None, "SplitAndDefer", start_date=start_date, stop_date=stop_date, activate_kw={'tag':tag})
<br> elif choice == 'CopyToTarget':<br> context.portal_simulation.solveMovement(movement, None,"CopyToTarget")<br><br> context.updateCausalityState()<br><br> if split_and_defer:<br>
# Create delivery<br> order = context.getCausalityValue()<br> applied_rule = order.getCausalityRelatedValue(portal_type="Applied Rule")<br><br> order_portal_type = order.getPortalType
()<br> if order_portal_type == 'Sale Order':<br> delivery_builder = order.portal_deliveries.sale_packing_list_builder<br> elif order_portal_type == 'Purchase Order':<br> delivery_builder =
order.portal_deliveries.purchase_packing_list_builder<br><br> explanation_uid_list = [order.getUid(),context.getUid()]<br> delivery_builder.activate(activity='SQLQueue',after_tag=tag).build(explanation_uid=explanation_uid_list)
<br> <br><br>redirect_url = '%s/%s?%s' % (context.absolute_url(), form_id, <br> 'portal_status_message=Sale+Packing+List+updated.')<br>context.REQUEST[ 'RESPONSE' ].redirect( redirect_url )
</pre></td></tr></tbody></table><br>Regards,<br>Shresth<br>