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
b30843d4
Commit
b30843d4
authored
Nov 17, 2021
by
François
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace use of in_ftop_team by (res.partner).shift_type == 'ftop'
parent
23ac5bdd
Pipeline
#1454
passed with stage
in 1 minute 30 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
29 deletions
+29
-29
admin.py
members/admin.py
+2
-2
models.py
members/models.py
+1
-1
members.js
members/static/js/members.js
+3
-3
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+1
-1
models.py
shifts/models.py
+6
-6
shift_exchange.js
shifts/static/js/shift_exchange.js
+12
-12
views.py
shifts/views.py
+2
-2
index.html
templates/members_space/index.html
+1
-1
shift_exchange.html
templates/shifts/shift_exchange.html
+1
-1
No files found.
members/admin.py
View file @
b30843d4
...
...
@@ -109,14 +109,14 @@ def add_pts_to_everybody(request, pts, reason):
is_connected_user
=
CagetteUser
.
are_credentials_ok
(
request
)
if
is_connected_user
is
True
:
try
:
fields
=
[
'
in_ftop_team
'
]
fields
=
[
'
shift_type
'
]
cond
=
[[
'is_member'
,
'='
,
True
]]
all_members
=
CagetteMembers
.
get
(
cond
,
fields
)
if
all_members
and
len
(
all_members
)
>
0
:
ftop_ids
=
[]
standard_ids
=
[]
for
m
in
all_members
:
if
m
[
'
in_ftop_team'
]
is
True
:
if
m
[
'
shift_type'
]
==
'ftop'
:
ftop_ids
.
append
(
m
[
'id'
])
else
:
standard_ids
.
append
(
m
[
'id'
])
...
...
members/models.py
View file @
b30843d4
...
...
@@ -21,7 +21,7 @@ FUNDRAISING_CAT_ID = {'A': 1, 'B': 2, 'C': 3}
class
CagetteMember
(
models
.
Model
):
"""Class to handle cagette Odoo member."""
m_default_fields
=
[
'name'
,
'parent_name'
,
'sex'
,
'image_medium'
,
'active'
,
'barcode_base'
,
'barcode'
,
'
in_ftop_team
'
,
'barcode_base'
,
'barcode'
,
'
shift_type
'
,
'is_associated_people'
,
'is_member'
,
'shift_type'
,
'display_ftop_points'
,
'display_std_points'
,
'is_exempted'
,
'cooperative_state'
,
'date_alert_stop'
]
...
...
members/static/js/members.js
View file @
b30843d4
...
...
@@ -394,7 +394,7 @@ function fill_service_entry_sucess(member) {
var
points
=
member
.
display_std_points
;
if
(
member
.
in_ftop_team
==
true
)
{
if
(
member
.
shift_type
==
'ftop'
)
{
points
=
member
.
display_ftop_points
;
}
pages
.
service_entry_success
.
find
(
'span.points'
).
text
(
points
);
...
...
@@ -410,7 +410,7 @@ function fill_service_entry_sucess(member) {
var
service_verb
=
'est prévu'
;
if
(
member
.
next_shift
)
{
if
(
member
.
in_ftop_team
==
true
if
(
member
.
shift_type
==
'ftop'
&&
member
.
next_shift
.
shift_type
==
"ftop"
)
{
var
start_elts
=
member
.
next_shift
.
start
.
split
(
' à '
);
...
...
@@ -468,7 +468,7 @@ function fill_rattrapage_2() {
var
msg
=
"Bienvenue pour ton rattrapage !"
;
var
shift_ticket_id
=
selected_service
.
shift_ticket_ids
[
0
];
if
(
current_displayed_member
.
in_ftop_team
==
true
)
{
if
(
current_displayed_member
.
shift_type
==
'ftop'
)
{
msg
=
"Bienvenue dans ce service !"
;
if
(
selected_service
.
shift_ticket_ids
[
1
])
shift_ticket_id
=
selected_service
.
shift_ticket_ids
[
1
];
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
b30843d4
...
...
@@ -32,7 +32,7 @@ function add_or_change_shift(new_shift_id) {
tData
=
'idNewShift='
+
new_shift_id
+
'&idPartner='
+
partner_data
.
partner_id
+
'&
in_ftop_team='
+
partner_data
.
in_ftop_team
+
'&
shift_type='
+
partner_data
.
shift_type
+
'&verif_token='
+
partner_data
.
verif_token
;
if
(
selected_shift
===
null
)
{
...
...
shifts/models.py
View file @
b30843d4
...
...
@@ -36,7 +36,7 @@ class CagetteShift(models.Model):
fields
=
[
'display_name'
,
'display_std_points'
,
'shift_type'
,
'date_alert_stop'
,
'date_delay_stop'
,
'extension_ids'
,
'cooperative_state'
,
'final_standard_point'
,
'create_date'
,
'final_ftop_point'
,
'
in_ftop_team
'
,
'leave_ids'
,
'makeups_to_do'
,
'barcode_base'
,
'final_ftop_point'
,
'
shift_type
'
,
'leave_ids'
,
'makeups_to_do'
,
'barcode_base'
,
'street'
,
'street2 ,'
'zip'
,
'city'
,
'mobile'
,
'phone'
,
'email'
,
'is_associated_people'
,
'parent_id'
]
partnerData
=
self
.
o_api
.
search_read
(
'res.partner'
,
cond
,
fields
,
1
)
...
...
@@ -129,14 +129,14 @@ class CagetteShift(models.Model):
fields
=
[
'stop_date'
,
'id'
,
'start_date'
]
return
self
.
o_api
.
search_read
(
'shift.leave'
,
cond
,
fields
)
def
get_shift_ticket
(
self
,
idShift
,
in_ftop_team
):
def
get_shift_ticket
(
self
,
idShift
,
shift_type
):
"""Récupérer le shift_ticket suivant le membre et flotant ou pas"""
if
getattr
(
settings
,
'USE_STANDARD_SHIFT'
,
True
)
==
False
:
in_ftop_team
=
"True
"
shift_type
=
"ftop
"
fields
=
[
'shift_ticket_ids'
]
cond
=
[[
'id'
,
"="
,
idShift
]]
listeTicket
=
self
.
o_api
.
search_read
(
'shift.shift'
,
cond
,
fields
)
if
in_ftop_team
==
"True
"
:
if
shift_type
==
"ftop
"
:
return
listeTicket
[
0
][
'shift_ticket_ids'
][
1
]
else
:
return
listeTicket
[
0
][
'shift_ticket_ids'
][
0
]
...
...
@@ -146,11 +146,11 @@ class CagetteShift(models.Model):
st_r_id
=
False
try
:
shift_type
=
"standard"
if
data
[
'
in_ftop_team'
]
==
"True
"
or
getattr
(
settings
,
'USE_STANDARD_SHIFT'
,
True
)
==
False
:
if
data
[
'
shift_type'
]
==
"ftop
"
or
getattr
(
settings
,
'USE_STANDARD_SHIFT'
,
True
)
==
False
:
shift_type
=
"ftop"
fieldsDatas
=
{
"partner_id"
:
data
[
'idPartner'
],
"shift_id"
:
data
[
'idShift'
],
"shift_ticket_id"
:
self
.
get_shift_ticket
(
data
[
'idShift'
],
data
[
'
in_ftop_team
'
]),
"shift_ticket_id"
:
self
.
get_shift_ticket
(
data
[
'idShift'
],
data
[
'
shift_type
'
]),
"shift_type"
:
shift_type
,
"origin"
:
'memberspace'
,
"is_makeup"
:
data
[
'is_makeup'
],
...
...
shifts/static/js/shift_exchange.js
View file @
b30843d4
...
...
@@ -57,7 +57,7 @@ function loadShiftPartner(partner_id) {
$
(
'#shift_msg'
).
remove
();
$
(
'#partnerData'
).
append
(
'<div id="shift_msg"></div>'
);
if
(
dataPartner
.
in_ftop_team
==
"True
"
||
listeShiftPartner
.
length
>
0
)
{
if
(
dataPartner
.
shift_type
==
"ftop
"
||
listeShiftPartner
.
length
>
0
)
{
// ftop, no shift planned
if
(
listeShiftPartner
.
length
==
0
)
{
var
date
=
new
Date
(
dataPartner
.
next_regular_shift_date
);
...
...
@@ -79,7 +79,7 @@ function loadShiftPartner(partner_id) {
// Set DOM for partner's shifts and shift message for ftops
iniListShift
(
listeShiftPartner
,
true
);
if
(
dataPartner
.
in_ftop_team
==
"True
"
)
{
if
(
dataPartner
.
shift_type
==
"ftop
"
)
{
$
(
'#shift_msg'
).
append
(
"<br /><strong>Je peux choisir d'autres services pour les mois à venir ou échanger un de ceux de la liste.</strong>"
);
}
}
...
...
@@ -92,7 +92,7 @@ function changeShift(idOldRegister, idNewShift) {
if
(
is_time_to
(
'change_shift'
))
{
openModal
();
// loading on
tData
=
'idNewShift='
+
idNewShift
+
'&idPartner='
+
dataPartner
.
partner_id
+
'&
in_ftop_team='
+
dataPartner
.
in_ftop_team
+
'&verif_token='
+
dataPartner
.
verif_token
;
tData
=
'idNewShift='
+
idNewShift
+
'&idPartner='
+
dataPartner
.
partner_id
+
'&
shift_type='
+
dataPartner
.
shift_type
+
'&verif_token='
+
dataPartner
.
verif_token
;
if
(
idOldRegister
==
""
)
{
tUrl
=
'/shifts/add_shift'
;
}
else
{
...
...
@@ -161,7 +161,7 @@ function canMakeExchange() {
var
answer
=
false
;
// Set the partner's limit date (after which he'll loose a point)
if
(
dataPartner
.
dateProlonge
!=
"False"
||
dataPartner
.
final_standard_point
<
0
||
dataPartner
.
in_ftop_team
==
"True
"
)
{
if
(
dataPartner
.
dateProlonge
!=
"False"
||
dataPartner
.
final_standard_point
<
0
||
dataPartner
.
shift_type
==
"ftop
"
)
{
var
dateProlonge
=
new
Date
(
dataPartner
.
dateProlonge
);
var
dateNextRegularShift
=
new
Date
(
dataPartner
.
next_regular_shift_date
);
...
...
@@ -170,7 +170,7 @@ function canMakeExchange() {
// For ABCD : the limit date is end of alert
var
dateEndAlert
=
new
Date
(
dataPartner
.
date_alert_stop
);
if
(
dataPartner
.
in_ftop_team
==
"False
"
&&
limitDate
<
dateEndAlert
)
{
if
(
dataPartner
.
shift_type
==
"ftop
"
&&
limitDate
<
dateEndAlert
)
{
limitDate
=
dateEndAlert
;
}
...
...
@@ -204,7 +204,7 @@ function canMakeExchange() {
});
// Allow exchange if points >= 0 or he already has enough services booked before the limit date
var
partner_points
=
dataPartner
.
in_ftop_team
==
"True
"
?
dataPartner
.
final_ftop_point
:
dataPartner
.
final_standard_point
;
var
partner_points
=
dataPartner
.
shift_type
==
"ftop
"
?
dataPartner
.
final_ftop_point
:
dataPartner
.
final_standard_point
;
if
(
partner_points
>=
0
||
shifts_before_limit
>=
1
)
{
answer
=
true
;
...
...
@@ -216,7 +216,7 @@ function canMakeExchange() {
}
// ftop can always exchange service
if
(
dataPartner
.
in_ftop_team
==
"True
"
)
{
if
(
dataPartner
.
shift_type
==
"ftop
"
)
{
answer
=
true
;
}
}
...
...
@@ -230,7 +230,7 @@ Génère le message à afficher lorsque le coop doit faire un rattrapage.
Pour les volants, chaque service compte comme un rattrapage.
*/
function
addMakeUpMsg
()
{
var
partner_points
=
dataPartner
.
in_ftop_team
==
"True
"
?
dataPartner
.
final_ftop_point
:
dataPartner
.
final_standard_point
;
var
partner_points
=
dataPartner
.
shift_type
==
"ftop
"
?
dataPartner
.
final_ftop_point
:
dataPartner
.
final_standard_point
;
let
shifts_before_limit
=
0
;
// Calcul du nombre de rattrapages à faire
...
...
@@ -281,7 +281,7 @@ function addMakeUpMsg() {
}
// Si le membre est un volant
if
(
dataPartner
.
in_ftop_team
==
"True
"
)
{
if
(
dataPartner
.
shift_type
==
"ftop
"
)
{
msg
=
"Je dois faire "
+
make_up_nb
+
" service"
;
if
(
make_up_nb
>
1
)
msg
+=
"s"
;
if
(
non_regular_shifts
.
length
>
0
)
msg
+=
" en plus"
;
...
...
@@ -320,7 +320,7 @@ function canAddShift(date_new_shift) {
var
answer
=
false
;
// If partner is ftop (ftop = volant)
if
(
dataPartner
[
"
in_ftop_team"
]
==
"True
"
)
{
if
(
dataPartner
[
"
shift_type"
]
==
"ftop
"
)
{
// If points >= 0 : can register to any shift
if
(
dataPartner
.
final_ftop_point
>=
0
)
{
answer
=
true
;
...
...
@@ -414,7 +414,7 @@ $(document).ready(function() {
loadShiftPartner
(
dataPartner
.
partner_id
);
// Display information depending on partner's type and state
if
(
dataPartner
.
in_ftop_team
==
"True
"
)
{
if
(
dataPartner
.
shift_type
==
"ftop
"
)
{
$
(
'div.intro div h2'
).
text
(
"Bienvenue dans le système de choix et d'échange de services"
);
$
(
'.additionnal_intro_data'
).
text
(
' ou en choisir un nouveau'
);
...
...
@@ -543,7 +543,7 @@ $(document).ready(function() {
// For partners who can't add a shift as it is
if
(
!
can_add_shift
)
{
// Partners who could ask for a delay
if
(
dataPartner
.
in_ftop_team
==
"True"
||
dataPartner
.
in_ftop_team
==
"False"
&&
dateShiftNew
>
limitDate
)
{
if
(
dataPartner
.
shift_type
==
"ftop"
||
dateShiftNew
>
limitDate
)
{
// Member can ask for 6 delays, which is 24 weeks after entering alert status
// 'date_alert_stop' field is begining of alert + 4 weeks
let
date_end_alert
=
new
Date
(
dataPartner
.
date_alert_stop
);
...
...
shifts/views.py
View file @
b30843d4
...
...
@@ -182,7 +182,7 @@ def change_shift(request):
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"idShift"
:
int
(
request
.
POST
[
'idNewShift'
]),
"
in_ftop_team"
:
request
.
POST
[
'in_ftop_team
'
],
"
shift_type"
:
request
.
POST
[
'shift_type
'
],
"is_makeup"
:
cs
.
shift_is_makeup
(
idOldShift
)
}
...
...
@@ -230,7 +230,7 @@ def add_shift(request):
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
]),
"idShift"
:
int
(
request
.
POST
[
'idNewShift'
]),
"
in_ftop_team"
:
request
.
POST
[
'in_ftop_team
'
],
"
shift_type"
:
request
.
POST
[
'shift_type
'
],
"is_makeup"
:
True
}
...
...
templates/members_space/index.html
View file @
b30843d4
...
...
@@ -82,7 +82,7 @@
var
partner_data
=
{
"partner_id"
:
"{{partnerData.id}}"
,
"name"
:
"{{partnerData.display_name}}"
,
"
in_ftop_team"
:
"{{partnerData.in_ftop_team
}}"
,
"
shift_type"
:
"{{partnerData.shift_type
}}"
,
"date_delay_stop"
:
"{{partnerData.date_delay_stop}}"
,
"cooperative_state"
:
"{{partnerData.cooperative_state}}"
,
"regular_shift_name"
:
"{{partnerData.regular_shift_name}}"
,
...
...
templates/shifts/shift_exchange.html
View file @
b30843d4
...
...
@@ -16,7 +16,7 @@
dataPartner
=
{
"partner_id"
:
"{{partnerData.id}}"
,
"name"
:
"{{partnerData.display_name}}"
,
"
in_ftop_team"
:
"{{partnerData.in_ftop_team
}}"
,
"
shift_type"
:
"{{partnerData.shift_type
}}"
,
"final_standard_point"
:
"{{partnerData.final_standard_point}}"
,
"final_ftop_point"
:
"{{partnerData.final_ftop_point}}"
,
"dateProlonge"
:
"{{partnerData.date_delay_stop}}"
,
...
...
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