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
41228043
Commit
41228043
authored
May 18, 2023
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3882 explication suppression presence
parent
66fc8c7c
Pipeline
#2740
passed with stage
in 1 minute 27 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
12 deletions
+30
-12
admin.py
members/admin.py
+3
-2
manage_shift_registrations.js
members/static/js/admin/manage_shift_registrations.js
+14
-7
models.py
shifts/models.py
+3
-2
manage_shift_registrations.html
templates/members/admin/manage_shift_registrations.html
+10
-1
No files found.
members/admin.py
View file @
41228043
...
...
@@ -498,15 +498,16 @@ def delete_shift_registration(request):
member_id
=
int
(
data
[
"member_id"
])
shift_registration_id
=
int
(
data
[
"shift_registration_id"
])
shift_is_makeup
=
data
[
"shift_is_makeup"
]
cancellation_description
=
data
[
"cancellation_description"
]
# Note: 'upcoming_registration_count' in res.partner won't change because the _compute method
# in odoo counts canceled shift registrations.
m
=
CagetteShift
()
res
[
"cancel_shift"
]
=
m
.
cancel_shift
([
shift_registration_id
],
origin
=
'bdm'
)
res
[
"cancel_shift"
]
=
m
.
cancel_shift
([
shift_registration_id
],
origin
=
'bdm'
,
description
=
cancellation_description
)
if
shift_is_makeup
is
True
:
fields
=
{
'name'
:
"Admin BDM
- Suppression d'un rattrapage"
,
'name'
:
"Admin BDM
(annulation de rattrapage par une annulation de présence) - "
+
cancellation_description
,
'shift_id'
:
False
,
'type'
:
data
[
"member_shift_type"
],
'partner_id'
:
member_id
,
...
...
members/static/js/admin/manage_shift_registrations.js
View file @
41228043
...
...
@@ -102,16 +102,21 @@ function display_member_shifts() {
const
shift_reg_id
=
row_data
.
id
;
const
shift_is_makeup
=
row_data
.
is_makeup
;
let
msg
=
`<p>Enlever la présence de <b>
${
member
.
name
}
</b> au service du <b>
${
row_data
.
shift_id
[
1
]}
</b> ?</p>`
;
let
modal_template
=
$
(
"#modal_delete_shift_registration"
);
modal_template
.
find
(
".member_name"
).
text
(
member
.
name
);
modal_template
.
find
(
".service_name"
).
text
(
row_data
.
shift_id
[
1
]);
if
(
shift_is_makeup
===
true
)
{
m
sg
+=
`<p><i class="fas fa-exclamation-triangle"></i> Ce service est un rattrapage. Le supprimer ajoutera un point au compteur de ce.tte membre.</p>`
;
m
odal_template
.
find
(
"#makeup_case_explanation"
).
show
()
;
}
openModal
(
msg
,
$
(
"#modal_delete_shift_registration"
).
html
()
,
()
=>
{
delete_shift_registration
(
shift_reg_id
,
shift_is_makeup
);
delete_shift_registration
(
shift_reg_id
,
shift_is_makeup
,
(
$
(
"#cancellation-explanation"
)[
0
].
value
||
"pas d'explication"
)
+
' : '
+
(
$
(
"#cancellation-signature"
)[
0
].
value
||
"auteur inconnu"
),
);
},
"Confirmer"
,
false
...
...
@@ -123,15 +128,17 @@ function display_member_shifts() {
* Send request to delete shift registration
* @param {Int} shift_reg_id Id of the shift_registration to delete
* @param {Boolean} shift_is_makeup Is the shift a makeup?
* @param {String} description explanation and signature for the cancellation from bdm
*/
function
delete_shift_registration
(
shift_reg_id
,
shift_is_makeup
)
{
function
delete_shift_registration
(
shift_reg_id
,
shift_is_makeup
,
description
)
{
openModal
();
data
=
{
member_id
:
selected_member
.
id
,
member_shift_type
:
selected_member
.
shift_type
,
shift_registration_id
:
shift_reg_id
,
shift_is_makeup
:
shift_is_makeup
shift_is_makeup
:
shift_is_makeup
,
cancellation_description
:
description
};
$
.
ajax
({
...
...
shifts/models.py
View file @
41228043
...
...
@@ -293,11 +293,12 @@ class CagetteShift(models.Model):
coop_logger
.
error
(
"Model affect shift nobody found :
%
s"
,
str
(
cond
))
return
response
def
cancel_shift
(
self
,
idsRegisteur
,
origin
=
'memberspace'
):
def
cancel_shift
(
self
,
idsRegisteur
,
origin
=
'memberspace'
,
description
=
None
):
"""Annule un shift"""
fieldsDatas
=
{
"related_shift_state"
:
'cancel'
,
"origin"
:
origin
,
"state"
:
'cancel'
}
"state"
:
'cancel'
,
"cancellation_description"
:
description
}
return
self
.
o_api
.
update
(
'shift.registration'
,
idsRegisteur
,
fieldsDatas
)
...
...
templates/members/admin/manage_shift_registrations.html
View file @
41228043
...
...
@@ -51,7 +51,16 @@
</div>
</div>
<div
id=
"templates"
style=
"display:none;"
></div>
<div
id=
"templates"
style=
"display:none;"
>
<div
id=
"modal_delete_shift_registration"
>
<p>
Enlever la présence de
<b><span
class=
"member_name"
></span></b>
au service du
<b><span
class=
"service_name"
></span></b>
?
</p>
<div
id=
"makeup_case_explanation"
style=
"display:none"
>
<p><i
class=
"fas fa-exclamation-triangle"
></i>
Ce service est un rattrapage. Le supprimer ajoutera un point au compteur de ce.tte membre.
</p>
</div>
<br><label
for=
"cancellation-explanation"
>
Explication :
</label><input
class=
""
type=
"text"
id=
"cancellation-explanation"
>
<br><br><label
for=
"cancellation-signature"
>
Signature :
</label><input
class=
""
type=
"text"
id=
"cancellation-signature"
>
</div>
</div>
</div>
<script
src=
'{% static "js/all_common.js" %}?v=1651853225'
></script>
...
...
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