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
ba85984c
Commit
ba85984c
authored
Mar 07, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert script to open order updater.
parent
45613b51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
9 deletions
+46
-9
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
...teItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
+45
-8
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_updateOpenOrder.xml
View file @
ba85984c
...
...
@@ -50,18 +50,23 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
person = context\n
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from DateTime import DateTime\n
person = context\n
portal = person.getPortalObject()\n
open_sale_order = portal.portal_catalog.getResultValue(\n
previous_
open_sale_order = portal.portal_catalog.getResultValue(\n
default_destination_section_uid=person.getUid(),\n
portal_type="Open Sale Order",\n
validation_state="validated")\n
\n
now = DateTime()\n
tag = \'%s_updateOpenOrder\' % person.getUid()\n
kw = {\'activate_kw\': {\'tag\': tag}}\n
if open_sale_order is None:\n
if portal.portal_activities.countMessageWithTag(tag) == 0:\n
open_order = portal.open_sale_order_module.newContent(\n
if portal.portal_activities.countMessageWithTag(tag) == 0:\n
open_sale_order = None\n
if previous_open_sale_order is None:\n
open_sale_order = portal.open_sale_order_module.newContent(\n
source=\'organisation_module/vifib_internet\',\n
source_section=\'organisation_module/vifib_internet\',\n
destination_section=person.getRelativeUrl(),\n
...
...
@@ -69,14 +74,46 @@ if open_sale_order is None:\n
destination=person.getRelativeUrl(),\n
price_currency=\'currency_module/EUR\',\n
specialise=\'sale_trade_condition_module/vifib_trade_condition\',\n
title="ViFiB Open Order", **kw)\n
title="ViFiB Open Order",\n
**kw)\n
if remove_id is not None:\n
if open_sale_order is not None:\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.deleteContent(remove_id, **kw)\n
if add_kw is not None:\n
add_kw.update(kw)\n
if open_sale_order is not None:\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.newContent(**add_kw)\n
if stop_date is not None:\n
# check if needed to update\n
need_update = False\n
for line in previous_open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n
if line.getStopDate() < stop_date:\n
need_update = True\n
break\n
if need_update:\n
if open_sale_order is not None:\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
for line in open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n
if line.getStopDate() < stop_date:\n
line.setStopDate(stop_date, **kw)\n
if previous_open_sale_order is not None and open_sale_order is not None:\n
previous_open_sale_order.setExpirationDate(now, **kw)\n
previous_open_sale_order.archive(**kw)\n
if open_sale_order is not None:\n
open_order.setEffectiveDate(now, **kw)\n
open_order.order(**kw)\n
open_order.validate(**kw)\n
</string>
</value>
elif remove_id is not None or add_kw is not None or stop_date is not None:\n
raise NotImplemnetedError(\'Person %s open sale order is already being modified\' % person.getPath())\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
remove_id=None, add_kw=None, stop_date=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/vifib_slap/bt/revision
View file @
ba85984c
601
\ No newline at end of file
602
\ 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