Commit e291ce5d authored by Łukasz Nowak's avatar Łukasz Nowak

Rebrand and simplify Invoice Builder.

Set more properties on invoice, as there are not merged anymore.

Drop delivery select method, as there is no need to merge invoices.
parent 888a8ba1
......@@ -106,6 +106,7 @@
<string>trade_phase/slapos/invoicing</string>
<string>predecessor/trade_state/delivered</string>
<string>successor/trade_state/invoiced</string>
<string>delivery_builder/portal_deliveries/slapos_sale_invoice_builder</string>
</tuple>
</value>
</item>
......
......@@ -65,7 +65,7 @@
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>VifibInvoiceTransaction_postGeneration</string> </value>
<value> <string>SlapOSSaleInvoiceTransaction_postGeneration</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
......@@ -130,15 +130,17 @@
</item>
<item>
<key> <string>delivery_select_method_id</string> </key>
<value> <string>VifibDeliveryBuilder_selectPlannedDeliveryList</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Builds Vifib Sale Invoices from Packing list related simulation movements</string> </value>
<value> <string>Builds Sale Invoices</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>vifib_sale_invoice_builder</string> </value>
<value> <string>slapos_sale_invoice_builder</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -152,11 +154,11 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
<value> <string>SlapOSDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Vifib Sale Invoice Builder</string> </value>
<value> <string>SlapOS Sale Invoice Builder</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -37,6 +37,7 @@
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>specialise</string>
<string>source</string>
<string>destination</string>
<string>source_section</string>
......
......@@ -37,7 +37,7 @@
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>specialise</string>
<string>aggregate</string>
<string>resource</string>
<string>quantity_unit</string>
<string>base_contribution</string>
......
<?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>
<none/>
</value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -66,31 +66,8 @@ if 1:\n
if not invoice.getResource():\n
invoice.setResource(invoice.getPriceCurrency())\n
\n
if invoice.getStartDate() is None:\n
invoice.setStartDate(DateTime())\n
\n
tag = \'%s_plan\' % invoice.getPath()\n
# initialize accounting_workflow to planned state\n
if invoice.getSimulationState() == \'draft\':\n
invoice.plan(comment=translateString(\'Initialised by Delivery Builder.\'), activate_kw={\'tag\': tag})\n
\n
# update specialise from movements\n
specialise_list = invoice.getSpecialiseList()\n
specialise_list.sort()\n
\n
modified = 0\n
for movement in invoice.getMovementList(portal_type=\'Invoice Line\'):\n
movement_specialise = movement.getSpecialise()\n
if movement_specialise not in specialise_list:\n
modified = 1\n
specialise_list.append(movement_specialise)\n
\n
if modified:\n
specialise_list.sort()\n
invoice.setSpecialiseList(specialise_list)\n
\n
if invoice.getPortalObject().portal_workflow.isTransitionPossible(invoice, \'start_building\'):\n
invoice.startBuilding()\n
invoice.plan(comment=translateString(\'Initialised by Delivery Builder.\'), activate_kw={\'tag\': tag})\n
invoice.startBuilding()\n
</string> </value>
</item>
<item>
......@@ -99,7 +76,7 @@ if invoice.getPortalObject().portal_workflow.isTransitionPossible(invoice, \'sta
</item>
<item>
<key> <string>id</string> </key>
<value> <string>VifibInvoiceTransaction_postGeneration</string> </value>
<value> <string>SlapOSSaleInvoiceTransaction_postGeneration</string> </value>
</item>
</dictionary>
</pickle>
......
50
\ No newline at end of file
51
\ No newline at end of file
......@@ -24,6 +24,8 @@ portal_alarms/slapos_request_update_hosting_subscription_open_sale_order
portal_alarms/slapos_trigger_build
portal_categories/trade_phase/slapos
portal_categories/trade_phase/slapos/**
portal_deliveries/slapos_sale_invoice_builder
portal_deliveries/slapos_sale_invoice_builder/**
portal_deliveries/slapos_sale_packing_list_builder
portal_deliveries/slapos_sale_packing_list_builder/**
portal_rules/slapos_invoice_simulation_rule
......
<?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[
movement = context\n
\n
business_link = movement.getCausalityValue(portal_type=\'Business Link\')\n
\n
rule_trade_phase_list = rule.getTradePhaseList()\n
if len(rule_trade_phase_list) > 0:\n
# if rule defines trade phase check if there is sense to apply it\n
if len(business_link.getParentValue().getBusinessLinkValueList(trade_phase=rule_trade_phase_list)) == 0:\n
# If Business Process does not define trade phase do not apply\n
return False\n
\n
if movement.getSimulationState() in business_link.getCompletedStateList():\n
return True\n
\n
return False\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>rule</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SimulationMovement_testCommonRule</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>portal_type = context.getDeliveryPortalType()\n
simulation_state = \'planned\'\n
\n
# use catalog to prefetch, but check later in ZODB\n
return [x.getObject() for x in context.getPortalObject().portal_catalog(\n
portal_type=portal_type,\n
default_destination_section_uid=kw[\'movement_list\'][0].getDestinationSectionUid(),\n
simulation_state=simulation_state) if x.getSimulationState() == simulation_state]\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>VifibDeliveryBuilder_selectPlannedDeliveryList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
518
\ No newline at end of file
519
\ No newline at end of file
132
\ No newline at end of file
133
\ No newline at end of file
......@@ -7,8 +7,6 @@ portal_deliveries/vifib_payment_transaction_builder
portal_deliveries/vifib_payment_transaction_builder/**
portal_deliveries/vifib_purchase_packing_list_builder
portal_deliveries/vifib_purchase_packing_list_builder/**
portal_deliveries/vifib_sale_invoice_builder
portal_deliveries/vifib_sale_invoice_builder/**
portal_deliveries/vifib_sale_invoice_transaction_builder
portal_deliveries/vifib_sale_invoice_transaction_builder/**
portal_deliveries/vifib_sale_invoice_transaction_trade_model_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