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

Migrate computer categories.

parent e12e82b8
......@@ -29,3 +29,39 @@ def Instance_migrateUrlString(self):
real(o[0])
else:
real(self)
def Computer_migrateCategory(self):
if self.getRelativeUrl() == 'computer_module/template_computer':
return
portal = self.getPortalObject()
def Computer_updateDestinationSection(computer):
# copy of portal_workflow/slapos_cloud_interaction_workflow/scripts/Computer_updateDestinationSection
subject_list = computer.getSubjectList()
person_list = []
for subject in subject_list:
if subject:
person_list.extend([x.getObject() for x in portal.portal_catalog(validation_state="validated", portal_type="Person", default_email_text=subject)])
computer.edit(destination_section_value_list=person_list)
@WorkflowMethod.disable
def real(self):
sale_supply_line_list = portal.portal_catalog(portal_type='Sale Supply Line',
default_aggregate_uid=self.getUid())
assert(1 == len(sale_supply_line_list))
internal_packing_list_line = portal.portal_catalog.getResultValue(
portal_type='Internal Packing List Line',
default_aggregate_uid=self.getUid(),
sort_on=(('creation_date', 'DESC'),)
)
assert(internal_packing_list_line is not None)
sale_trade_condition = sale_supply_line_list[0].getParentValue()
self.edit(
source_administration=internal_packing_list_line.getParentValue().getSourceAdministration(),
subject_list=sale_trade_condition.getSubjectList(),
)
Computer_updateDestinationSection(self)
real(self)
<?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 = context.getPortalObject()\n
tag = script.id\n
method_id = \'Computer_migrateCategory\'\n
for module in (\n
portal.computer_module,\n
):\n
module.recurseCallMethod(\n
method_id,\n
max_depth=1,\n
min_depth=1,\n
max_retry=0,\n
activate_kw={\'tag\': script.id}\n
)\n
\n
return \'Done.\'\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>01_ERP5Site_migrateComputerCategory</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>Computer_migrateCategory</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSUpgrader</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_migrateCategory</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
9
\ No newline at end of file
10
\ 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