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
8d67c83d
Commit
8d67c83d
authored
Sep 28, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare blocking extension if member can't have it
parent
ad4867a3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
members-space-home.js
members_space/static/js/members-space-home.js
+10
-1
models.py
shifts/models.py
+5
-0
views.py
shifts/views.py
+9
-1
No files found.
members_space/static/js/members-space-home.js
View file @
8d67c83d
...
@@ -39,6 +39,14 @@ function request_delay() {
...
@@ -39,6 +39,14 @@ function request_delay() {
resolve
();
resolve
();
},
},
error
:
function
(
data
)
{
error
:
function
(
data
)
{
if
(
data
.
status
==
403
&&
typeof
data
.
responseJSON
!=
'undefined'
&&
data
.
responseJSON
.
message
===
"delays limit reached"
)
{
closeModal
();
alert
(
"Vous avez mis plus de 6 mois pour rattraper un service, "
+
"vous ne pouvez plus sélectionner de rattrapage depuis l'espace membre. "
+
"Merci de contacter le BDM."
);
}
else
{
err
=
{
msg
:
"erreur serveur lors de la création du délai"
,
ctx
:
'request_delay'
};
err
=
{
msg
:
"erreur serveur lors de la création du délai"
,
ctx
:
'request_delay'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
...
@@ -46,9 +54,10 @@ function request_delay() {
...
@@ -46,9 +54,10 @@ function request_delay() {
report_JS_error
(
err
,
'members_space.home'
);
report_JS_error
(
err
,
'members_space.home'
);
closeModal
();
closeModal
();
// TODO Notify
alert
(
'Erreur lors de la création du délai.'
);
alert
(
'Erreur lors de la création du délai.'
);
}
}
}
});
});
});
});
}
}
...
...
shifts/models.py
View file @
8d67c83d
...
@@ -314,3 +314,7 @@ class CagetteShift(models.Model):
...
@@ -314,3 +314,7 @@ class CagetteShift(models.Model):
return
self
.
o_api
.
update
(
'res.partner'
,
partner_id
,
f
)
return
self
.
o_api
.
update
(
'res.partner'
,
partner_id
,
f
)
else
:
else
:
return
"makeups already at 0"
return
"makeups already at 0"
def
member_can_have_delay
(
self
,
partner_id
):
""" Can a member have a delay? """
return
self
.
o_api
.
execute
(
'res.partner'
,
'can_have_extension'
,
[
partner_id
])
\ No newline at end of file
shifts/views.py
View file @
8d67c83d
...
@@ -265,8 +265,16 @@ def add_shift(request):
...
@@ -265,8 +265,16 @@ def add_shift(request):
def
request_delay
(
request
):
def
request_delay
(
request
):
if
'verif_token'
in
request
.
POST
:
if
'verif_token'
in
request
.
POST
:
if
Verification
.
verif_token
(
request
.
POST
.
get
(
'verif_token'
),
int
(
request
.
POST
.
get
(
'idPartner'
)))
is
True
:
if
Verification
.
verif_token
(
request
.
POST
.
get
(
'verif_token'
),
int
(
request
.
POST
.
get
(
'idPartner'
)))
is
True
:
cs
=
CagetteShift
()
cs
=
CagetteShift
()
# TODO do we need this?
# use_new_members_space = getattr(settings, 'USE_NEW_MEMBERS_SPACE', False)
# if use_new_members_space is True:
# member_can_have_delay = cs.member_can_have_delay(int(request.POST.get('idPartner')))
# if member_can_have_delay is False:
# res = { 'message' : 'delays limit reached'}
# return JsonResponse(res, status=403)
data
=
{
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"start_date"
:
request
.
POST
[
'start_date'
]
"start_date"
:
request
.
POST
[
'start_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