Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
3f652128
Commit
3f652128
authored
May 24, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Hosting Subscription itself to create journal.
parent
62eedc11
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
72 deletions
+30
-72
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_getOpenOrderDifference.xml
...portal_skins/vifib_slap/Person_getOpenOrderDifference.xml
+1
-12
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml
.../portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml
+26
-54
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
...teItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
+2
-5
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
No files found.
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_getOpenOrderDifference.xml
View file @
3f652128
...
@@ -87,7 +87,6 @@ for (add_kw, explanation) in add_kw_list:\n
...
@@ -87,7 +87,6 @@ for (add_kw, explanation) in add_kw_list:\n
add_kw_kw[add_kw[\'aggregate\']][\'explanation\'] = [\'Added because of %s \' % explanation]\n
add_kw_kw[add_kw[\'aggregate\']][\'explanation\'] = [\'Added because of %s \' % explanation]\n
\n
\n
modify_kw_kw = {}\n
modify_kw_kw = {}\n
hs_modify_kw_kw = {}\n
for start_date_tuple in start_date_tuple_list:\n
for start_date_tuple in start_date_tuple_list:\n
start_date_tuple, explanation = start_date_tuple[0:2], start_date_tuple[2]\n
start_date_tuple, explanation = start_date_tuple[0:2], start_date_tuple[2]\n
start_date = getClosestDate(target_date=start_date_tuple[1], precision=\'day\')\n
start_date = getClosestDate(target_date=start_date_tuple[1], precision=\'day\')\n
...
@@ -105,16 +104,6 @@ for start_date_tuple in start_date_tuple_list:\n
...
@@ -105,16 +104,6 @@ for start_date_tuple in start_date_tuple_list:\n
add_kw_kw[start_date_tuple[0]][\'start_date\'] = start_date\n
add_kw_kw[start_date_tuple[0]][\'start_date\'] = start_date\n
add_kw_kw[start_date_tuple[0]][\'explanation\'].append(\'Added start date beacuse of %s\' % explanation)\n
add_kw_kw[start_date_tuple[0]][\'explanation\'].append(\'Added start date beacuse of %s\' % explanation)\n
start_date_modified = True\n
start_date_modified = True\n
if start_date_modified:\n
hs = portal.restrictedTraverse(start_date_tuple[0])\n
if hs.getPeriodicityMonthDayList() != [start_date.day()]:\n
hs_modify_kw_kw.setdefault(start_date_tuple[0], {})\n
hs_modify_kw_kw[start_date_tuple[0]] = dict(\n
periodicity_month_day_list = [start_date.day()],\n
periodicity_hour_list=[0],\n
periodicity_minute_list=[0]\n
)\n
hs_modify_kw_kw[start_date_tuple[0]][\'explanation\'] = \'Set up because of %s\' % explanation\n
\n
\n
if previous_open_sale_order is not None:\n
if previous_open_sale_order is not None:\n
for line in previous_open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n
for line in previous_open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n
...
@@ -179,7 +168,7 @@ if previous_open_sale_order is not None:\n
...
@@ -179,7 +168,7 @@ if previous_open_sale_order is not None:\n
order_line_cancelled =
True\n
order_line_cancelled =
True\n
if
order_line_cancelled
or
(line.getStartDate()
is
not
None
and
line.getStopDate()
is
not
None
and
line.getStartDate()
<
line.getStopDate()):\n
if
order_line_cancelled
or
(line.getStartDate()
is
not
None
and
line.getStopDate()
is
not
None
and
line.getStartDate()
<
line.getStopDate()):\n
remove_id_list.add((line.getId(),
\'Removed
%s\'
%
line.getPath()))\n
remove_id_list.add((line.getId(),
\'Removed
%s\'
%
line.getPath()))\n
return
add_kw_kw,
modify_kw_kw,
hs_modify_kw_kw,
list(remove_id_list)\n
return
add_kw_kw,
modify_kw_kw,
list(remove_id_list)\n
]]
></string>
</value>
]]
></string>
</value>
...
...
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml
View file @
3f652128
...
@@ -50,14 +50,8 @@
...
@@ -50,14 +50,8 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
person = context
\n
<value>
<string>
from Products.ZSQLCatalog.SQLCatalog import Query
\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
catalog = portal.portal_catalog\n
\n
cleanup_resource_uid = portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceCleanupResource()).getUid()\n
setup_resource_uid = portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid()\n
\n
person_uid = person.getUid()\n
\n
\n
kw = {}\n
kw = {}\n
if modification_date is not None:\n
if modification_date is not None:\n
...
@@ -67,25 +61,17 @@ remove_hosting_list = []\n
...
@@ -67,25 +61,17 @@ remove_hosting_list = []\n
add_kw_list = []\n
add_kw_list = []\n
start_date_tuple_list = []\n
start_date_tuple_list = []\n
\n
\n
movement
_kw = kw.copy()\n
hosting
_kw = kw.copy()\n
movement_kw[\'movement.destination_uid\'] = person_uid
\n
\n
for cleanup_line in catalog(
\n
hosting_kw[\'default_destination_section_uid\'] = context.getUid()
\n
portal_type=\'Sale Packing List Line\',
\n
\n
default_resource_uid=cleanup_resource_uid,
\n
def getWorkflowDate(document, state):
\n
simulation_state=\'delivered\',
\n
workflow_item_list = portal.portal_workflow.getInfoFor(ob=document, name=\'history\', wf_id=\'instance_slap_interface_workflow\')
\n
**movement_kw)
:\n
for item in workflow_item_list
:\n
aggregate = cleanup_line.getAggregate(portal_type=\'Hosting Subscription\')
\n
if item.get(\'slap_state\') == state:
\n
if aggregate not in remove_hosting_list:
\n
return item.get(\'time\')
\n
remove_hosting_list.append((aggregate, cleanup_line.getPath()
))\n
raise ValueError(\'Document %s has no state %s\' % (document.getPath(), state
))\n
\n
\n
for cancelled_line in catalog(\n
portal_type=\'Sale Order Line\',\n
default_resource_uid=setup_resource_uid,\n
simulation_state=\'cancelled\',\n
**movement_kw):\n
aggregate = cancelled_line.getAggregate(portal_type=\'Hosting Subscription\')\n
if aggregate not in remove_hosting_list:\n
remove_hosting_list.append((aggregate, cancelled_line.getPath()))\n
\n
\n
subscription_service_relative_url=portal.portal_preferences.getPreferredInstanceSubscriptionResource()\n
subscription_service_relative_url=portal.portal_preferences.getPreferredInstanceSubscriptionResource()\n
common_add_kw = dict(\n
common_add_kw = dict(\n
...
@@ -96,41 +82,27 @@ common_add_kw = dict(\n
...
@@ -96,41 +82,27 @@ common_add_kw = dict(\n
resource=subscription_service_relative_url,\n
resource=subscription_service_relative_url,\n
price=portal.restrictedTraverse(subscription_service_relative_url).getSaleSupplyLineBasePrice()\n
price=portal.restrictedTraverse(subscription_service_relative_url).getSaleSupplyLineBasePrice()\n
)\n
)\n
for order in catalog(\n
for hosting_subscription in portal.portal_catalog(\n
portal_type=\'Sale Order\',\n
portal_type=\'Hosting Subscription\',\n
simulation_state=[\'planned\', \'ordered\',\'confirmed\'],\n
**hosting_kw\n
default_destination_decision_uid=person_uid,\n
**kw\n
):\n
):\n
hosting_subscription = order.getMovementList()[0].getAggregate(portal_type=\'Hosting Subscription\')\n
add_kw = common_add_kw.copy()\n
add_kw = common_add_kw.copy()\n
add_kw.update(\n
add_kw.update(\n
title=
portal.restrictedTraverse(hosting_subscription)
.getTitle(),\n
title=
hosting_subscription
.getTitle(),\n
aggregate=hosting_subscription\n
aggregate=hosting_subscription
.getRelativeUrl()
\n
)\n
)\n
add_kw_list.append((add_kw, order.getPath()))\n
add_kw_list.append((add_kw, hosting_subscription.getPath()))\n
\n
if hosting_subscription.getSlapState() == \'destroyed_requested\':\n
def getWorkflowDate(delivery, state):\n
remove_hosting_list.append((hosting_subscription.getRelativeUrl(), hosting_subscription.getPath()))\n
workflow_item_list = portal.portal_workflow.getInfoFor(ob=delivery, name=\'history\', wf_id=\'packing_list_workflow\')\n
try:\n
for item in workflow_item_list:\n
start_date = getWorkflowDate(hosting_subscription, \'request_instance\')\n
if item.get(\'simulation_state\') == state:\n
except ValueError:\n
return item.get(\'time\')\n
pass\n
raise ValueError(\'Delivery %s has no state %s\' % (delivery.getPath(), state))\n
else:\n
start_date_tuple_list.append((hosting_subscription.getRelativeUrl(), start_date, hosting_subscription.getPath()))\n
\n
\n
for setup_line in catalog(\n
portal_type=\'Sale Packing List Line\',\n
default_resource_uid=setup_resource_uid,\n
simulation_state=[\'stopped\', \'delivered\'],\n
**movement_kw):\n
real_setup_line = catalog.getResultValue(portal_type=\'Sale Packing List Line\', simulation_state=[\'stopped\', \'delivered\'],\n
default_resource_uid=setup_resource_uid,\n
default_aggregate_uid=setup_line.getAggregateValue(portal_type=\'Hosting Subscription\').getUid(),\n
sort_on=((\'movement.start_date\', \'ascending\'),))\n
# start date shall be stopped state reach\n
start_date = getWorkflowDate(real_setup_line.getParentValue(), \'stopped\')\n
start_date_tuple_list.append((setup_line.getAggregate(portal_type=\'Hosting Subscription\'), start_date, real_setup_line.getPath()))\n
\n
\n
result =
person
.Person_updateOpenOrder(src__=src__, remove_hosting_list=remove_hosting_list, add_kw_list=add_kw_list, start_date_tuple_list=start_date_tuple_list, stop_date=stop_date)\n
result =
context
.Person_updateOpenOrder(src__=src__, remove_hosting_list=remove_hosting_list, add_kw_list=add_kw_list, start_date_tuple_list=start_date_tuple_list, stop_date=stop_date)\n
from pprint import pformat\n
from pprint import pformat\n
return pformat(result)\n
return pformat(result)\n
</string>
</value>
</string>
</value>
...
...
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
View file @
3f652128
...
@@ -65,15 +65,12 @@ if portal.portal_activities.countMessageWithTag(tag) > 0:\n
...
@@ -65,15 +65,12 @@ if portal.portal_activities.countMessageWithTag(tag) > 0:\n
def storeWorkflowComment(document, comment):\n
def storeWorkflowComment(document, comment):\n
portal.portal_workflow.doActionFor(document, \'edit_action\', comment=comment)\n
portal.portal_workflow.doActionFor(document, \'edit_action\', comment=comment)\n
\n
\n
add_kw_kw, modify_kw_kw,
hs_modify_kw_kw,
remove_id_list = context.Person_getOpenOrderDifference(\n
add_kw_kw, modify_kw_kw, remove_id_list = context.Person_getOpenOrderDifference(\n
remove_hosting_list=remove_hosting_list, add_kw_list=add_kw_list,\n
remove_hosting_list=remove_hosting_list, add_kw_list=add_kw_list,\n
stop_date=stop_date, start_date_tuple_list=start_date_tuple_list)\n
stop_date=stop_date, start_date_tuple_list=start_date_tuple_list)\n
\n
\n
if src__== 1:\n
if src__== 1:\n
return add_kw_kw, modify_kw_kw, hs_modify_kw_kw, remove_id_list\n
return add_kw_kw, modify_kw_kw, remove_id_list\n
\n
for hs, kw in hs_modify_kw_kw.iteritems():\n
portal.restrictedTraverse(hs).edit(activate_kw=activate_kw, **kw)\n
\n
\n
now = DateTime()\n
now = DateTime()\n
previous_open_sale_order = portal.portal_catalog.getResultValue(\n
previous_open_sale_order = portal.portal_catalog.getResultValue(\n
...
...
master/bt5/vifib_slap/bt/revision
View file @
3f652128
736
737
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment