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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
10 deletions
+31
-10
members-space-home.js
members_space/static/js/members-space-home.js
+16
-7
models.py
shifts/models.py
+6
-2
views.py
shifts/views.py
+9
-1
No files found.
members_space/static/js/members-space-home.js
View file @
8d67c83d
...
...
@@ -39,15 +39,24 @@ function request_delay() {
resolve
();
},
error
:
function
(
data
)
{
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'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
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'
};
if
(
typeof
data
.
responseJSON
!=
'undefined'
&&
typeof
data
.
responseJSON
.
error
!=
'undefined'
)
{
err
.
msg
+=
' : '
+
data
.
responseJSON
.
error
;
}
report_JS_error
(
err
,
'members_space.home'
);
closeModal
();
alert
(
'Erreur lors de la création du délai.'
);
}
report_JS_error
(
err
,
'members_space.home'
);
closeModal
();
// TODO Notify
alert
(
'Erreur lors de la création du délai.'
);
}
});
});
...
...
shifts/models.py
View file @
8d67c83d
...
...
@@ -313,4 +313,8 @@ class CagetteShift(models.Model):
return
self
.
o_api
.
update
(
'res.partner'
,
partner_id
,
f
)
else
:
return
"makeups already at 0"
\ No newline at end of file
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):
def
request_delay
(
request
):
if
'verif_token'
in
request
.
POST
:
if
Verification
.
verif_token
(
request
.
POST
.
get
(
'verif_token'
),
int
(
request
.
POST
.
get
(
'idPartner'
)))
is
True
:
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
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"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