Commit 82160e3e authored by Łukasz Nowak's avatar Łukasz Nowak

Confirm invoice immediately after building.

parent fe0f6f9f
......@@ -66,7 +66,9 @@ if 1:\n
if not invoice.getResource():\n
invoice.setResource(invoice.getPriceCurrency())\n
\n
invoice.plan(comment=translateString(\'Initialised by Delivery Builder.\'))\n
comment = translateString(\'Initialised by Delivery Builder.\')\n
invoice.plan(comment=comment)\n
invoice.confirm(comment=comment)\n
invoice.startBuilding()\n
</string> </value>
</item>
......
80
\ No newline at end of file
81
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_confirmPlannedSaleInvoiceTransaction</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>confirm_planned_sale_invoice_transaction</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>3660.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Confirm planned Sale Invoices before current month</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getClosestDate\n
\n
portal = context.getPortalObject()\n
this_month = getClosestDate(target_date=DateTime())\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'planned\',\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
\n
context.activate(after_tag=tag).getId()\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_confirmPlannedSaleInvoiceTransaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
isTransitionPossible = context.getPortalObject().portal_workflow.isTransitionPossible\n
if context.getSimulationState() == \'planned\' and context.getStartDate() < this_month:\n
if len(context.getMovementList()) > 0:\n
if isTransitionPossible(context, \'confirm\'):\n
context.confirm(comment=\'Confirmed as ready to be accounted.\')\n
# as user will not have any invoice in planned state create new one, a bit later, in order to have current state reindexed\n
context.getDestinationValue().activate(after_path_and_method_id=(context.getPath(), (\'recursiveImmediateReindexObject\', \'immediateReindexObject\'))).fixConsistency()\n
else:\n
old_date = context.getStartDate()\n
context.setStartDate(this_month)\n
context.portal_workflow.doActionFor(context, \'edit_action\', comment=\'Moved date from %s to %s in order to move to new month.\' % (old_date, context.getStartDate()))\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>
878
\ No newline at end of file
879
\ No newline at end of file
portal_alarms/cleanup_active_process
portal_alarms/confirm_planned_sale_invoice_transaction
portal_alarms/stop_confirmed_sale_invoice_transaction
portal_alarms/vifib_bang_selenium_tester_instance
portal_alarms/vifib_check_consistency
......
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