Commit 33f57830 authored by Łukasz Nowak's avatar Łukasz Nowak

Convert to searchAndActivate.

parent 60066663
......@@ -57,22 +57,21 @@ from Products.ERP5Type.DateUtils import getClosestDate\n
\n
portal = context.getPortalObject()\n
this_month = getClosestDate(target_date=DateTime())\n
for sale_invoice_transaction in portal.portal_catalog(\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'planned\',\n
limit=10,\n
method_id=\'SaleInvoiceTransaction_confirmPlanned\',\n
method_kw={\'this_month\': this_month},\n
activate_kw={\'tag\': tag},\n
**{"delivery.start_date": \'< %s\' % this_month}\n
):\n
if sale_invoice_transaction.getSimulationState() == \'planned\' and sale_invoice_transaction.getStartDate() < this_month:\n
# do not trust catalog\n
sale_invoice_transaction.confirm()\n
)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
if context.getSimulationState() == \'planned\' and context.getStartDate() < this_month:\n
context.confirm()\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>this_month</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleInvoiceTransaction_confirmPlanned</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
554
\ No newline at end of file
555
\ No newline at end of file
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