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

Migrate Open Sale Orders separately.

Not all Open Sale Orders have lines, but all have to be migrated.
parent db269087
from DateTime import DateTime
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
@WorkflowMethod.disable @WorkflowMethod.disable
...@@ -22,20 +23,25 @@ def DeliveryLineSetZeroPriceAndOrUpdateAppliedRule(self): ...@@ -22,20 +23,25 @@ def DeliveryLineSetZeroPriceAndOrUpdateAppliedRule(self):
self.setQuantity(1.0) self.setQuantity(1.0)
self.Delivery_updateAppliedRule() self.Delivery_updateAppliedRule()
from DateTime import DateTime @WorkflowMethod.disable
def OpenSaleOrder_migrate(self):
if self.getSpecialise() != 'sale_trade_condition_module/vifib_simple_trade_condition':
self.setSpecialise('sale_trade_condition_module/vifib_trade_simple_condition')
destination = self.getDestination() or self.getDestinationDecision() or self.getDestinationSection()
assert destination is not None
if self.getDestinationDecision() != destination:
self.setDestinationDecision(destination)
if self.getDestinationSection() != destination:
self.setDestinationSection(destination)
if self.getSource() != 'organisation_module/vifib_internet':
self.setSource('organisation_module/vifib_internet')
if self.getSourceSection() != 'organisation_module/vifib_internet':
self.setSourceSection('organisation_module/vifib_internet')
if self.getPriceCurrency() != 'currency_module/EUR':
self.setPriceCurrency('currency_module/EUR')
@WorkflowMethod.disable @WorkflowMethod.disable
def OpenSaleOrderLine_migrate(self): def OpenSaleOrderLine_migrate(self):
open_sale_order = self.getParentValue()
if open_sale_order.getSpecialise() != 'sale_trade_condition_module/vifib_simple_trade_condition':
open_sale_order.setSpecialise('sale_trade_condition_module/vifib_simple_trade_condition')
if open_sale_order.getDestinationDecision() != open_sale_order.getDestination():
open_sale_order.setDestinationDecision(open_sale_order.getDestination())
if open_sale_order.getSource() != 'organisation_module/vifib_internet':
open_sale_order.setSource('organisation_module/vifib_internet')
if open_sale_order.getSourceSection() != 'organisation_module/vifib_internet':
open_sale_order.setSourceSection('organisation_module/vifib_internet')
if open_sale_order.getPriceCurrency() != 'currency_module/EUR':
open_sale_order.setPriceCurrency('currency_module/EUR')
now = DateTime().earliestTime() now = DateTime().earliestTime()
self.setStartDate(now) self.setStartDate(now)
self.setStopDate(now) self.setStopDate(now)
......
<?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>context.getPortalObject().portal_catalog.searchAndActivate(\n
portal_type=\'Open Sale Order\',\n
method_id=\'OpenSaleOrder_migrate\'\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_initiateOpenSaleOrderMigration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>OpenSaleOrder_migrate</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibUpgrader</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ExtensionOpenSaleOrder_migrate</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></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>return context.ExtensionOpenSaleOrder_migrate(context)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_migrate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
71 72
\ No newline at end of file \ 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