Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
26fc2d5d
Commit
26fc2d5d
authored
Sep 27, 2021
by
François
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modifications pour avoir souplesse paramétrage absence
parent
f8e05261
Pipeline
#1325
passed with stage
in 1 minute 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
models.py
members/models.py
+7
-1
models.py
shifts/models.py
+1
-1
views.py
shifts/views.py
+3
-3
No files found.
members/models.py
View file @
26fc2d5d
...
@@ -1142,6 +1142,12 @@ class CagetteServices(models.Model):
...
@@ -1142,6 +1142,12 @@ class CagetteServices(models.Model):
# let authorized people time to set presence for those who came in late
# let authorized people time to set presence for those who came in late
end_date
=
now
-
datetime
.
timedelta
(
hours
=
3
)
end_date
=
now
-
datetime
.
timedelta
(
hours
=
3
)
api
=
OdooAPI
()
api
=
OdooAPI
()
absence_status
=
'excused'
res_c
=
api
.
search_read
(
'ir.config_parameter'
,
[[
'key'
,
'='
,
'lacagette_membership.absence_status'
]],
[
'value'
])
if
len
(
res_c
)
==
1
:
absence_status
=
res_c
[
0
][
'value'
]
cond
=
[[
'date_begin'
,
'>='
,
date_24h_before
.
isoformat
()],
cond
=
[[
'date_begin'
,
'>='
,
date_24h_before
.
isoformat
()],
[
'date_begin'
,
'<='
,
end_date
.
isoformat
()],
[
'date_begin'
,
'<='
,
end_date
.
isoformat
()],
[
'state'
,
'='
,
'open'
]]
[
'state'
,
'='
,
'open'
]]
...
@@ -1165,7 +1171,7 @@ class CagetteServices(models.Model):
...
@@ -1165,7 +1171,7 @@ class CagetteServices(models.Model):
(
_h
,
_m
,
_s
)
=
h
.
split
(
':'
)
(
_h
,
_m
,
_s
)
=
h
.
split
(
':'
)
if
int
(
_h
)
<
21
:
if
int
(
_h
)
<
21
:
ids
.
append
(
int
(
r
[
'id'
]))
ids
.
append
(
int
(
r
[
'id'
]))
f
=
{
'state'
:
'excused'
}
f
=
{
'state'
:
absence_status
}
return
{
'update'
:
api
.
update
(
'shift.registration'
,
ids
,
f
),
'reg_shift'
:
res
}
return
{
'update'
:
api
.
update
(
'shift.registration'
,
ids
,
f
),
'reg_shift'
:
res
}
@staticmethod
@staticmethod
...
...
shifts/models.py
View file @
26fc2d5d
...
@@ -242,7 +242,7 @@ class CagetteShift(models.Model):
...
@@ -242,7 +242,7 @@ class CagetteShift(models.Model):
for
val
in
extension_types
:
for
val
in
extension_types
:
if
val
[
'name'
]
==
'Extension'
:
if
val
[
'name'
]
==
'Extension'
:
ext_type_id
=
val
[
'id'
]
ext_type_id
=
val
[
'id'
]
starting_date
=
datetime
.
datetime
.
strptime
(
data
[
'start_date'
],
'
%
Y-
%
m-
%
d'
)
.
date
()
starting_date
=
datetime
.
datetime
.
strptime
(
data
[
'start_date'
],
'
%
Y-
%
m-
%
d'
)
.
date
()
ending_date
=
(
starting_date
+
datetime
.
timedelta
(
days
=
duration
))
ending_date
=
(
starting_date
+
datetime
.
timedelta
(
days
=
duration
))
...
...
shifts/views.py
View file @
26fc2d5d
...
@@ -239,11 +239,9 @@ def request_delay(request):
...
@@ -239,11 +239,9 @@ def request_delay(request):
}
}
if
(
'extension_beginning'
in
request
.
POST
):
if
(
'extension_beginning'
in
request
.
POST
):
data
[
'extension_beginning'
]
=
request
.
POST
[
'extension_beginning'
]
data
[
'extension_beginning'
]
=
request
.
POST
[
'extension_beginning'
]
duration
=
28
if
(
'duration'
in
request
.
POST
):
if
(
'duration'
in
request
.
POST
):
duration
=
int
(
request
.
POST
[
'duration'
])
duration
=
int
(
request
.
POST
[
'duration'
])
else
:
duration
=
None
response
=
{
'result'
:
False
}
response
=
{
'result'
:
False
}
...
@@ -252,8 +250,10 @@ def request_delay(request):
...
@@ -252,8 +250,10 @@ def request_delay(request):
if
(
new_id
):
if
(
new_id
):
response
=
{
'result'
:
True
}
response
=
{
'result'
:
True
}
else
:
else
:
coop_logger
.
error
(
"request delay :
%
s,
%
s"
,
str
(
new_id
),
str
(
data
))
return
HttpResponseServerError
()
return
HttpResponseServerError
()
except
Exception
as
e
:
except
Exception
as
e
:
coop_logger
.
error
(
"request delay :
%
s,
%
s"
,
str
(
e
),
str
(
data
))
return
HttpResponseServerError
()
return
HttpResponseServerError
()
return
JsonResponse
(
response
)
return
JsonResponse
(
response
)
...
...
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