Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
a6b59a54
Commit
a6b59a54
authored
Feb 23, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
calendar: use addToDate function to manipulate DateTime.
It allows to create new DateTime with the same timezone.
parent
3c43b7db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
bt5/erp5_hr_calendar/WorkflowTemplateItem/portal_workflow/hr_calendar_interaction_workflow/scripts/TimeTableLine_afterEdit.xml
..._interaction_workflow/scripts/TimeTableLine_afterEdit.xml
+3
-2
product/ERP5/Document/PresencePeriod.py
product/ERP5/Document/PresencePeriod.py
+1
-1
No files found.
bt5/erp5_hr_calendar/WorkflowTemplateItem/portal_workflow/hr_calendar_interaction_workflow/scripts/TimeTableLine_afterEdit.xml
View file @
a6b59a54
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
# automatically set a good start and stop date to make generic code working\n
# automatically set a good start and stop date to make generic code working\n
\n
\n
from DateTime import DateTime\n
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import addToDate\n
time_table_line = state_change["object"]\n
time_table_line = state_change["object"]\n
\n
\n
day_of_week = time_table_line.getDayOfWeek()\n
day_of_week = time_table_line.getDayOfWeek()\n
...
@@ -63,9 +64,9 @@ if not(None in (day_of_week, quantity)):\n
...
@@ -63,9 +64,9 @@ if not(None in (day_of_week, quantity)):\n
time_table_line.setPeriodicityWeekDayList([day_of_week])\n
time_table_line.setPeriodicityWeekDayList([day_of_week])\n
start_date = DateTime("2014/04/01")\n
start_date = DateTime("2014/04/01")\n
while start_date.Day() != day_of_week:\n
while start_date.Day() != day_of_week:\n
start_date =
start_date + 1
\n
start_date =
addToDate(start_date, day=1)
\n
time_table_line.setStartDate(start_date)\n
time_table_line.setStartDate(start_date)\n
stop_date =
start_date + 1.0/24*quantity
\n
stop_date =
addToDate(start_date, hour=quantity)
\n
time_table_line.setStopDate(stop_date)\n
time_table_line.setStopDate(stop_date)\n
# after change, make sure to update group calendars through the usual alarm\n
# after change, make sure to update group calendars through the usual alarm\n
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(\n
context.getPortalObject().portal_alarms.update_time_table_end_periodicity.activate(\n
...
...
product/ERP5/Document/PresencePeriod.py
View file @
a6b59a54
...
@@ -152,7 +152,7 @@ class PresencePeriod(Movement, PeriodicityMixin):
...
@@ -152,7 +152,7 @@ class PresencePeriod(Movement, PeriodicityMixin):
second_duration
=
int
(
stop_date
)
-
int
(
start_date
)
second_duration
=
int
(
stop_date
)
-
int
(
start_date
)
if
second_duration
>
0
:
if
second_duration
>
0
:
# First date has to respect the periodicity config
# First date has to respect the periodicity config
next_start_date
=
self
.
getNextPeriodicalDate
(
start_date
-
1
)
next_start_date
=
self
.
getNextPeriodicalDate
(
addToDate
(
start_date
,
day
=-
1
)
)
while
(
next_start_date
is
not
None
)
and
\
while
(
next_start_date
is
not
None
)
and
\
(
next_start_date
<=
periodicity_stop_date
):
(
next_start_date
<=
periodicity_stop_date
):
...
...
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