Commit 1f490c51 by Damien Moulard

Merge branch 'evolution_bdm' of…

Merge branch 'evolution_bdm' of gl.cooperatic.fr:cooperatic-foodcoops/third-party into evolution_bdm
parents 468bdf99 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'])
......
......@@ -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']
......
......@@ -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];
......
......@@ -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) {
......
......@@ -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'],
......
......@@ -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);
......
......@@ -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
}
......
......@@ -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}}",
......
......@@ -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}}",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment