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
Labels
Merge Requests
23
Merge Requests
23
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
8eaf6e96
Commit
8eaf6e96
authored
Mar 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify and optimise conditions.
parent
f37e7e27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
45 deletions
+49
-45
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
...teItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml
+48
-44
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 @
8eaf6e96
...
@@ -54,6 +54,12 @@
...
@@ -54,6 +54,12 @@
from DateTime import DateTime\n
from DateTime import DateTime\n
\n
\n
tag = \'%s_updateOpenOrder\' % person.getUid()\n
kw = {\'activate_kw\': {\'tag\': tag}}\n
if portal.portal_activities.countMessageWithTag(tag) >
0:\n
# nothing to do\n
return\n
\n
if remove_id_list is None:\n
if remove_id_list is None:\n
remove_id_list = []\n
remove_id_list = []\n
\n
\n
...
@@ -65,53 +71,51 @@ previous_open_sale_order = portal.portal_catalog.getResultValue(\n
...
@@ -65,53 +71,51 @@ previous_open_sale_order = portal.portal_catalog.getResultValue(\n
validation_state="validated")\n
validation_state="validated")\n
\n
\n
now = DateTime()\n
now = DateTime()\n
tag = \'%s_updateOpenOrder\' % person.getUid()\n
\n
kw = {\'activate_kw\': {\'tag\': tag}}\n
open_sale_order = None\n
if portal.portal_activities.countMessageWithTag(tag) == 0:\n
if previous_open_sale_order is None:\n
open_sale_order = None\n
open_sale_order = portal.open_sale_order_module.newContent(\n
if previous_open_sale_order is None:\n
source=\'organisation_module/vifib_internet\',\n
open_sale_order = portal.open_sale_order_module.newContent(\n
source_section=\'organisation_module/vifib_internet\',\n
source=\'organisation_module/vifib_internet\',\n
destination_section=person.getRelativeUrl(),\n
source_section=\'organisation_module/vifib_internet\',\n
destination_decision=person.getRelativeUrl(),\n
destination_section=person.getRelativeUrl(),\n
destination=person.getRelativeUrl(),\n
destination_decision=person.getRelativeUrl(),\n
price_currency=\'currency_module/EUR\',\n
destination=person.getRelativeUrl(),\n
specialise=\'sale_trade_condition_module/vifib_trade_condition\',\n
price_currency=\'currency_module/EUR\',\n
title="ViFiB Open Order",\n
specialise=\'sale_trade_condition_module/vifib_trade_condition\',\n
**kw)\n
title="ViFiB Open Order",\n
for remove_id in remove_id_list:\n
**kw)\n
if open_sale_order is None:\n
for remove_id in remove_id_list:\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
if open_sale_order is None:\n
open_sale_order.deleteContent(remove_id)\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
if add_kw is not None:\n
open_sale_order.deleteContent(remove_id)\n
add_tag = add_kw.pop(\'tag\', None)\n
if add_kw is not None:\n
add_kw.update(kw)\n
add_tag = add_kw.pop(\'tag\', None)\n
if open_sale_order is None:\n
add_kw.update(kw)\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.newContent(**add_kw)\n
if add_tag is not None:\n
# lock by passed tag\n
open_sale_order.activate(tag=add_tag, after_tag=kw[\'activate_kw\'][\'tag\']).getId()\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
None:\n
if
open_sale_order
is
None:\n
open_sale_order =
previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order =
previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.newContent(**add_kw)\n
for
line
in
open_sale_order.contentValues(
portal_type=
\'Open
Sale
Order
Line\'):\n
if add_tag is not None:\n
# lock by passed tag\n
open_sale_order.activate(tag=add_tag, after_tag=kw[\'activate_kw\'][\'tag\']).getId()\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
if
line.getStopDate()
<
stop_date:\n
need_update = True\n
line.setStopDate(stop_date,
**kw)\n
break\n
if
previous_open_sale_order
is
not
None
and
open_sale_order
is
not
None:\n
if need_update:\n
previous_open_sale_order.setExpirationDate(now,
**kw)\n
if open_sale_order is 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.setEffectiveDate(now,
**kw)\n
for line in open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n
open_sale_order.order(**kw)\n
if line.getStopDate() < stop_date:\n
open_sale_order.validate(**kw)\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
if open_sale_order is not None:\n
open_sale_order.setEffectiveDate(now, **kw)\n
open_sale_order.order(**kw)\n
open_sale_order.validate(**kw)\n
]]
></string>
</value>
]]
></string>
</value>
...
...
master/bt5/vifib_slap/bt/revision
View file @
8eaf6e96
622
623
\ 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