Commit b35b8d44 authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'origin/master' into zope4py2

parents 64e9f5d8 8148bdab
maileva_connector = context.portal_catalog.getResultValue(
portal_type='Maileva SOAP Connector',
reference=reference,
validation_state='validated')
if not maileva_connector:
......
......@@ -67,10 +67,7 @@
<item>
<key> <string>workflow_managed_permission</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
<string>Add portal content</string>
</tuple>
<tuple/>
</value>
</item>
</dictionary>
......
......@@ -9,10 +9,7 @@
<item>
<key> <string>acquire_permission</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
<string>Add portal content</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -67,42 +64,7 @@
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Associate</string>
<string>Author</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Author</string>
<string>Associate</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
</dictionary>
......
......@@ -9,10 +9,7 @@
<item>
<key> <string>acquire_permission</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
<string>Add portal content</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -66,42 +63,7 @@
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Associate</string>
<string>Author</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Author</string>
<string>Associate</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
</dictionary>
......
......@@ -9,10 +9,7 @@
<item>
<key> <string>acquire_permission</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
<string>Add portal content</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -66,42 +63,7 @@
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Associate</string>
<string>Author</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Author</string>
<string>Associate</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
</dictionary>
......
......@@ -9,10 +9,7 @@
<item>
<key> <string>acquire_permission</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
<string>Add portal content</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -57,42 +54,7 @@
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Associate</string>
<string>Author</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Author</string>
<string>Associate</string>
<string>Member</string>
<string>Assignee</string>
<string>Manager</string>
<string>Auditor</string>
<string>Owner</string>
<string>Reviewer</string>
</tuple>
</value>
</item>
</dictionary>
<dictionary/>
</value>
</item>
</dictionary>
......
......@@ -28,6 +28,8 @@ from __future__ import absolute_import
#
##############################################################################
import datetime
from DateTime import DateTime
from .TargetSolver import TargetSolver
class CopyToTarget(TargetSolver):
......@@ -60,13 +62,11 @@ class CopyToTarget(TargetSolver):
quantity_ratio = 0
if old_quantity not in (None,0.0): # XXX: What if quantity happens to be an integer ?
quantity_ratio = new_quantity / old_quantity
start_date_delta = 0
stop_date_delta = 0
# get the date delta in milliseconds, to prevent rounding issues
stop_date_delta = start_date_delta = datetime.timedelta()
if new_start_date is not None and old_start_date is not None:
start_date_delta = new_start_date.millis() - old_start_date.millis()
start_date_delta = new_start_date.asdatetime() - old_start_date.asdatetime()
if new_stop_date is not None and old_stop_date is not None:
stop_date_delta = new_stop_date.millis() - old_stop_date.millis()
stop_date_delta = new_stop_date.asdatetime() - old_stop_date.asdatetime()
return {
'quantity_ratio': quantity_ratio,
'start_date_delta': start_date_delta,
......@@ -87,15 +87,14 @@ class CopyToTarget(TargetSolver):
"""
Generate values to save on simulation movement.
"""
from erp5.component.module.DateUtils import createDateTimeFromMillis
value_dict = {}
# Modify quantity, start_date, stop_date
start_date = simulation_movement.getStartDate()
if start_date is not None:
value_dict['start_date'] = createDateTimeFromMillis(start_date.millis() + start_date_delta)
value_dict['start_date'] = DateTime(start_date.asdatetime() + start_date_delta)
stop_date = simulation_movement.getStopDate()
if stop_date is not None:
value_dict['stop_date'] = createDateTimeFromMillis(stop_date.millis() + stop_date_delta)
value_dict['stop_date'] = DateTime(stop_date.asdatetime() + stop_date_delta)
value_dict['quantity'] = simulation_movement.getQuantity() * quantity_ratio
return value_dict
......
......@@ -453,30 +453,6 @@ def convertDateToHour(date=None):
hour_ = (ordinal_date - ordinal_reference_date) * number_of_hours_in_day + number_of_hours_in_day + date.hour()
return int(hour_)
def createDateTimeFromMillis(millis): # pylint: disable=redefined-outer-name
"""
Returns a DateTime object, build from the number of milliseconds since epoch.
Parameter should be a int or long.
This one should be used by solvers, as DateTime.__cmp__ actually only
compares the _millis parameter of the two DateTime objects.
This is currently not perfect: DateTime only supports creating a new object
from a floating point number of seconds since epoch, so a rounding issue is
still possible, that's why _millis is explicitely set to the same value
after the DateTime object has been created from (millis / 1000.)
A better way would be to compute (yr,mo,dy,hr,mn,sc,tz,t,d,s,millisecs) from
millis, and then create the DateTime object from it (see "elif ac == 11:" in
DateTime._parse_args).
Another solution would be a DateTime implementation that relies exclusively
on integer values internally.
"""
millis = long(millis)
date = DateTime(millis / 1000.)
date._millis = millis
return date
def getNumberOfDayInMonth(date):
month = date.month()
......
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