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
e5d02715
Commit
e5d02715
authored
Oct 26, 2022
by
François C.
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ticket_3965' into 'dev_cooperatic'
Ticket 3965 See merge request
!215
parents
06bf7b9c
1fc30fb1
Pipeline
#2465
passed with stage
in 1 minute 26 seconds
Changes
11
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
38 additions
and
19 deletions
+38
-19
admin.py
members/admin.py
+6
-3
manage_makeups.js
members/static/js/admin/manage_makeups.js
+3
-4
models.py
members_space/models.py
+7
-0
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+2
-2
members-space.js
members_space/static/js/members-space.js
+4
-4
views.py
members_space/views.py
+4
-1
config.md
outils/config.md
+4
-0
models.py
shifts/models.py
+1
-2
manage_makeups.html
templates/members/admin/manage_makeups.html
+4
-1
index.html
templates/members_space/index.html
+2
-1
shifts_exchange.html
templates/members_space/shifts_exchange.html
+1
-1
No files found.
members/admin.py
View file @
e5d02715
...
...
@@ -7,6 +7,7 @@ from members.models import CagetteMembers
from
members.models
import
CagetteMember
from
shifts.models
import
CagetteServices
from
shifts.models
import
CagetteShift
from
members_space.models
import
CagetteMembersSpace
from
outils.common
import
MConfig
from
datetime
import
datetime
,
date
...
...
@@ -120,7 +121,7 @@ default_msettings = {'msg_accueil': {'title': 'Message borne accueil',
'sort_order'
:
16
},
'member_cant_have_delay_form_link'
:
{
'title'
:
'Lien vers le formulaire pour les membres n
\'
ayant pas rattrapé leur service après
6 mois
'
,
'title'
:
'Lien vers le formulaire pour les membres n
\'
ayant pas rattrapé leur service après
la durée de l
\'
extension
'
,
'type'
:
'text'
,
'value'
:
''
,
'class'
:
'link'
,
...
...
@@ -320,8 +321,11 @@ def admin(request):
def
manage_makeups
(
request
):
""" Administration des membres """
template
=
loader
.
get_template
(
'members/admin/manage_makeups.html'
)
m
=
CagetteMembersSpace
()
context
=
{
'title'
:
'BDM - Rattrapages'
,
'module'
:
'Membres'
}
'module'
:
'Membres'
,
'extension_duration'
:
m
.
get_extension_duration
()
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
manage_shift_registrations
(
request
):
...
...
@@ -443,7 +447,6 @@ def regenerate_member_delay(request):
duration
=
raw_data
[
"duration"
]
ext_name
=
"Délai étendue depuis l'admin BDM"
res
[
"create_delay"
]
=
cs
.
create_delay
(
data
=
data
,
duration
=
duration
,
ext_name
=
ext_name
)
if
(
res
[
"create_delay"
]):
...
...
members/static/js/admin/manage_makeups.js
View file @
e5d02715
...
...
@@ -351,10 +351,9 @@ function extend_member_delay(member) {
openModal
();
let
today
=
new
Date
();
let
today_plus_six_month
=
new
Date
();
today_plus_six_month
.
setMonth
(
today_plus_six_month
.
getMonth
()
+
6
);
const
diff_time
=
Math
.
abs
(
today_plus_six_month
-
today
);
let
today_plus_extension_duration
=
new
Date
();
today_plus_extension_duration
.
setMonth
(
today_plus_extension_duration
.
getMonth
()
+
extension_duration
);
const
diff_time
=
Math
.
abs
(
today_plus_extension_duration
-
today
);
const
diff_days
=
Math
.
ceil
(
diff_time
/
(
1000
*
60
*
60
*
24
));
let
data
=
{
...
...
members_space/models.py
View file @
e5d02715
...
...
@@ -27,6 +27,13 @@ class CagetteMembersSpace(models.Model):
answer
=
True
return
answer
def
get_extension_duration
(
self
):
"""Return nb of months"""
# TODO : add a unit parameter and convert if not month
extension_duration
=
OdooAPI
()
.
get_system_param
(
'lacagette_membership.extension_duration'
)
nb
,
unit
=
extension_duration
.
split
(
' '
)
return
nb
def
get_shifts_history
(
self
,
partner_id
,
limit
,
offset
,
date_from
):
""" Get partner shifts history """
res
=
[]
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
e5d02715
...
...
@@ -613,12 +613,12 @@ function init_calendar_page() {
}
else
if
(
should_select_makeup
())
{
/* choose a makeup service */
// Check if selected new shift is in less than
6 months
// Check if selected new shift is in less than
extension end
if
(
partner_data
.
date_delay_stop
!==
'False'
)
{
date_partner_delay_stop
=
new
Date
(
partner_data
.
date_delay_stop
);
if
(
datetime_new_shift
>
date_partner_delay_stop
)
{
let
msg
=
`Vous avez jusqu'au
${
date_partner_delay_stop
.
toLocaleDateString
(
"fr-fr"
,
date_options
)}
`
+
`pour sélectionner un rattrapage (soit une période de
6
mois depuis votre absence).`
;
`pour sélectionner un rattrapage (soit une période de
${
extension_duration
}
mois depuis votre absence).`
;
alert
(
msg
);
...
...
members_space/static/js/members-space.js
View file @
e5d02715
...
...
@@ -139,10 +139,10 @@ function request_delay() {
const
delay_start
=
today
.
getFullYear
()
+
'-'
+
(
today
.
getMonth
()
+
1
)
+
'-'
+
today
.
getDate
();
let
today_plus_
six_month
=
new
Date
();
let
today_plus_
extension_duration
=
new
Date
();
today_plus_
six_month
.
setMonth
(
today_plus_six_month
.
getMonth
()
+
6
);
const
diff_time
=
Math
.
abs
(
today_plus_
six_month
-
today
);
today_plus_
extension_duration
.
setMonth
(
today_plus_extension_duration
.
getMonth
()
+
extension_duration
);
const
diff_time
=
Math
.
abs
(
today_plus_
extension_duration
-
today
);
const
diff_days
=
Math
.
ceil
(
diff_time
/
(
1000
*
60
*
60
*
24
));
$
.
ajax
({
...
...
@@ -157,7 +157,7 @@ function request_delay() {
},
success
:
function
()
{
partner_data
.
cooperative_state
=
'delay'
;
partner_data
.
date_delay_stop
=
today_plus_
six_month
.
getFullYear
()
+
'-'
+
(
today_plus_six_month
.
getMonth
()
+
1
)
+
'-'
+
today_plus_six_month
.
getDate
();
partner_data
.
date_delay_stop
=
today_plus_
extension_duration
.
getFullYear
()
+
'-'
+
(
today_plus_extension_duration
.
getMonth
()
+
1
)
+
'-'
+
today_plus_extension_duration
.
getDate
();
resolve
();
},
...
...
members_space/views.py
View file @
e5d02715
...
...
@@ -121,6 +121,7 @@ def index(request, exception=None):
partnerData
[
"associated_partner_name"
]
=
str
(
associated_partner
[
"barcode_base"
])
+
' - '
+
partnerData
[
"associated_partner_name"
]
m
=
CagetteMembersSpace
()
context
[
'extension_duration'
]
=
m
.
get_extension_duration
()
context
[
'show_faq'
]
=
getattr
(
settings
,
'MEMBERS_SPACE_FAQ_TEMPLATE'
,
'members_space/faq.html'
)
context
[
'show_abcd_calendar'
]
=
getattr
(
settings
,
'SHOW_ABCD_CALENDAR_TAB'
,
True
)
partnerData
[
"comite"
]
=
m
.
is_comite
(
partner_id
)
...
...
@@ -221,9 +222,11 @@ def my_shifts(request):
def
shifts_exchange
(
request
):
""" Endpoint the front-end will call to load the "Shifts exchange" page. """
template
=
loader
.
get_template
(
'members_space/shifts_exchange.html'
)
m
=
CagetteMembersSpace
()
context
=
{
'title'
:
'Échange de Services'
,
'canAddShift'
:
getattr
(
settings
,
'CAN_ADD_SHIFT'
,
False
)
'canAddShift'
:
getattr
(
settings
,
'CAN_ADD_SHIFT'
,
False
),
'extension_duration'
:
m
.
get_extension_duration
()
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
...
...
outils/config.md
View file @
e5d02715
...
...
@@ -350,6 +350,10 @@
By default, False.
-
EXTENSION_TYPE_ID = 6
By default 1. Extension type id (from shift_extension_type table) used to create extension
### Reception
-
RECEPTION_ADD_ADMIN_MODE = True
...
...
shifts/models.py
View file @
e5d02715
...
...
@@ -345,7 +345,6 @@ class CagetteShift(models.Model):
fields
=
[
'extension_ids'
]
partner_extensions
=
self
.
o_api
.
search_read
(
'res.partner'
,
cond
,
fields
)
response
=
False
# If has extensions
if
'extension_ids'
in
partner_extensions
[
0
]:
# Look for current extension: started before today and ends after
...
...
@@ -378,7 +377,7 @@ class CagetteShift(models.Model):
else
:
# Get the 'Extension' type id
extension_types
=
self
.
o_api
.
search_read
(
'shift.extension.type'
)
ext_type_id
=
1
# Default
ext_type_id
=
getattr
(
settings
,
'EXTENSION_TYPE_ID'
,
1
)
for
val
in
extension_types
:
if
val
[
'name'
]
==
'Extension'
:
ext_type_id
=
val
[
'id'
]
...
...
templates/members/admin/manage_makeups.html
View file @
e5d02715
...
...
@@ -61,7 +61,7 @@
<p>
Vous vous apprêtez à rallonger le délai de
<span
class=
"member_name"
></span>
pour une durée de
6
mois à partir d'aujourd'hui.
pour une durée de
{{extension_duration}}
mois à partir d'aujourd'hui.
</p>
</div>
<div
id=
"modal_incr_makeup_counter"
>
...
...
@@ -84,4 +84,7 @@
<script
src=
'{% static "js/all_common.js" %}?v=1651853225'
></script>
<script
src=
'{% static "js/admin/manage_makeups.js" %}?v=1651853225'
></script>
<script>
const
extension_duration
=
{{
extension_duration
}};
</script>
{% endblock %}
templates/members_space/index.html
View file @
e5d02715
...
...
@@ -93,7 +93,7 @@
</div>
<div
id=
"cant_have_delay_msg_template"
>
<h3>
Bonjour, tu avais
6
mois pour rattraper tes services manqués et il semblerait que tu ne l'aies pas fait.
</h3>
<h3>
Bonjour, tu avais
{{extension_duration}}
mois pour rattraper tes services manqués et il semblerait que tu ne l'aies pas fait.
</h3>
<h3>
Tu ne peux plus sélectionner de rattrapages sur ton espace membre pour le moment,
merci de contacter le bureau des membres pour résoudre ce problème en remplissant ce formulaire :
</h3>
</div>
...
...
@@ -156,6 +156,7 @@
var
block_actions_for_attached_people
=
'{{block_actions_for_attached_people}}'
;
var
block_service_exchange_24h_before
=
'{{block_service_exchange_24h_before}}'
;
const
canAddShift
=
{{
canAddShift
}};
const
extension_duration
=
{{
extension_duration
}};
</script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
1651853225"
></script>
<script
src=
"{% static "
js
/
common
.
js
"
%}?
v=
1651853225"
></script>
...
...
templates/members_space/shifts_exchange.html
View file @
e5d02715
...
...
@@ -18,7 +18,7 @@
<div
id=
"suspended_content"
class=
"shifts_exchange_page_content"
>
<h3>
J'ai
<span
class=
"makeups_nb"
></span>
rattrapage(s) à effectuer, je dois le(s) sélectionner pour pouvoir refaire mes courses.
J'ai
6
mois de délai pour le(s) rattraper.
J'ai
{{extension_duration}}
mois de délai pour le(s) rattraper.
</h3>
<h3>
Si besoin, je peux contacter le Bureau des membres via la rubrique "J'ai une demande" pour expliquer ma situation.
...
...
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