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
298c4ee4
Commit
298c4ee4
authored
Mar 10, 2022
by
Etienne Freiss
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_cooperatic' into 2496-create-connection-for-shift-registration-station
parents
1828883a
17a551fc
Pipeline
#1928
passed with stage
in 1 minute 30 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
11 deletions
+44
-11
admin.py
members/admin.py
+14
-4
manage_shift_registrations.css
members/static/css/admin/manage_shift_registrations.css
+4
-0
manage_shift_registrations.js
members/static/js/admin/manage_shift_registrations.js
+20
-5
models.py
shifts/models.py
+6
-2
No files found.
members/admin.py
View file @
298c4ee4
...
@@ -385,14 +385,24 @@ def delete_shift_registration(request):
...
@@ -385,14 +385,24 @@ def delete_shift_registration(request):
is_connected_user
=
CagetteUser
.
are_credentials_ok
(
request
)
is_connected_user
=
CagetteUser
.
are_credentials_ok
(
request
)
if
is_connected_user
is
True
:
if
is_connected_user
is
True
:
data
=
json
.
loads
(
request
.
body
.
decode
())
data
=
json
.
loads
(
request
.
body
.
decode
())
shift_registration_id
=
int
(
data
[
"shift_registration_id"
])
member_id
=
int
(
data
[
"member_id"
])
member_id
=
int
(
data
[
"member_id"
])
shift_registration_id
=
int
(
data
[
"shift_registration_id"
])
m
=
CagetteShift
()
shift_is_makeup
=
data
[
"shift_is_makeup"
]
res
[
"res"
]
=
m
.
cancel_shift
([
shift_registration_id
])
# Note: 'upcoming_registration_count' in res.partner won't change because the _compute method
# Note: 'upcoming_registration_count' in res.partner won't change because the _compute method
# in odoo counts canceled shift registrations.
# in odoo counts canceled shift registrations.
m
=
CagetteShift
()
res
[
"cancel_shift"
]
=
m
.
cancel_shift
([
shift_registration_id
])
if
shift_is_makeup
is
True
:
fields
=
{
'name'
:
"Admin BDM - Suppression d'un rattrapage"
,
'shift_id'
:
False
,
'type'
:
data
[
"member_shift_type"
],
'partner_id'
:
member_id
,
'point_qty'
:
1
}
res
[
"update_counter"
]
=
m
.
update_counter_event
(
fields
)
response
=
JsonResponse
(
res
,
safe
=
False
)
response
=
JsonResponse
(
res
,
safe
=
False
)
else
:
else
:
...
...
members/static/css/admin/manage_shift_registrations.css
View file @
298c4ee4
...
@@ -38,6 +38,10 @@
...
@@ -38,6 +38,10 @@
padding-top
:
0.755em
;
padding-top
:
0.755em
;
}
}
.makeup_row
{
background-color
:
#ffc854
!important
;
}
/* Search membres area */
/* Search membres area */
#search_member_area
{
#search_member_area
{
margin-top
:
30px
;
margin-top
:
30px
;
...
...
members/static/js/admin/manage_shift_registrations.js
View file @
298c4ee4
...
@@ -88,17 +88,29 @@ function display_member_shifts() {
...
@@ -88,17 +88,29 @@ function display_member_shifts() {
"sLoadingRecords"
:
"Chargement en cours..."
,
"sLoadingRecords"
:
"Chargement en cours..."
,
"sZeroRecords"
:
"Aucun élément à afficher"
,
"sZeroRecords"
:
"Aucun élément à afficher"
,
"sEmptyTable"
:
"Aucun futur service pour ce.tte membre"
"sEmptyTable"
:
"Aucun futur service pour ce.tte membre"
}
},
createdRow
:
function
(
row
,
rdata
)
{
if
(
rdata
.
is_makeup
===
true
)
{
$
(
row
).
addClass
(
"makeup_row"
);
$
(
row
).
prop
(
'title'
,
'Ce service est un rattrapage'
);
}
},
});
});
$
(
'#member_shifts_table'
).
on
(
'click'
,
'tbody td .delete_shift_registration'
,
function
()
{
$
(
'#member_shifts_table'
).
on
(
'click'
,
'tbody td .delete_shift_registration'
,
function
()
{
const
row_data
=
member_shifts_table
.
row
(
$
(
this
).
parents
(
'tr'
)).
data
();
const
row_data
=
member_shifts_table
.
row
(
$
(
this
).
parents
(
'tr'
)).
data
();
const
shift_reg_id
=
row_data
.
id
;
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>`
;
if
(
shift_is_makeup
===
true
)
{
msg
+=
`<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>`
;
}
openModal
(
openModal
(
`Enlever la présence de
${
member
.
name
}
au service du
${
row_data
.
shift_id
[
1
]}
?`
,
msg
,
()
=>
{
()
=>
{
delete_shift_registration
(
shift_reg_id
);
delete_shift_registration
(
shift_reg_id
,
shift_is_makeup
);
},
},
"Confirmer"
,
"Confirmer"
,
false
false
...
@@ -109,13 +121,16 @@ function display_member_shifts() {
...
@@ -109,13 +121,16 @@ function display_member_shifts() {
/**
/**
* Send request to delete shift registration
* Send request to delete shift registration
* @param {Int} shift_reg_id Id of the shift_registration to delete
* @param {Int} shift_reg_id Id of the shift_registration to delete
* @param {Boolean} shift_is_makeup Is the shift a makeup?
*/
*/
function
delete_shift_registration
(
shift_reg_id
)
{
function
delete_shift_registration
(
shift_reg_id
,
shift_is_makeup
)
{
openModal
();
openModal
();
data
=
{
data
=
{
member_id
:
selected_member
.
id
,
member_id
:
selected_member
.
id
,
shift_registration_id
:
shift_reg_id
member_shift_type
:
selected_member
.
shift_type
,
shift_registration_id
:
shift_reg_id
,
shift_is_makeup
:
shift_is_makeup
};
};
$
.
ajax
({
$
.
ajax
({
...
...
shifts/models.py
View file @
298c4ee4
...
@@ -367,4 +367,8 @@ class CagetteShift(models.Model):
...
@@ -367,4 +367,8 @@ class CagetteShift(models.Model):
def
member_can_have_delay
(
self
,
partner_id
):
def
member_can_have_delay
(
self
,
partner_id
):
""" Can a member have a delay? """
""" Can a member have a delay? """
return
self
.
o_api
.
execute
(
'res.partner'
,
'can_have_extension'
,
[
partner_id
])
return
self
.
o_api
.
execute
(
'res.partner'
,
'can_have_extension'
,
[
partner_id
])
\ No newline at end of file
def
update_counter_event
(
self
,
fields
):
""" Add/remove points """
return
self
.
o_api
.
create
(
'shift.counter.event'
,
fields
)
\ No newline at end of file
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