Commit 18211df1 by Administrator

Merge branch '5266-ajout-colonne-rattrapage-choisis' into 'dev_cooperatic'

add column, rewording and change column order

See merge request !248
parents 2751827f 719e1215
Pipeline #3137 failed with stage
in 1 minute 6 seconds
...@@ -845,8 +845,9 @@ class CagetteMember(models.Model): ...@@ -845,8 +845,9 @@ class CagetteMember(models.Model):
elif search_type == "makeups_data": elif search_type == "makeups_data":
fields = CagetteMember.m_short_default_fields fields = CagetteMember.m_short_default_fields
fields = fields + ['shift_type', 'makeups_to_do', 'display_ftop_points', 'display_std_points', 'shift_type'] fields = fields + ['shift_type', 'makeups_to_do', 'display_ftop_points', 'display_std_points', 'shift_type']
return api.search_read('res.partner', cond, fields) res = api.search_read('res.partner', cond, fields)
CagetteMembers.add_makeups_to_come_to_member_data(res)
return res
elif search_type == "shift_template_data": elif search_type == "shift_template_data":
fields = CagetteMember.m_short_default_fields fields = CagetteMember.m_short_default_fields
fields = fields + ['id', 'makeups_to_do', 'cooperative_state','parent_name'] fields = fields + ['id', 'makeups_to_do', 'cooperative_state','parent_name']
...@@ -1282,9 +1283,18 @@ class CagetteMembers(models.Model): ...@@ -1282,9 +1283,18 @@ class CagetteMembers(models.Model):
fields = ['id', 'name', 'display_std_points', 'display_ftop_points', 'shift_type', 'makeups_to_do', 'date_delay_stop'] fields = ['id', 'name', 'display_std_points', 'display_ftop_points', 'shift_type', 'makeups_to_do', 'date_delay_stop']
res = api.search_read('res.partner', cond, fields) res = api.search_read('res.partner', cond, fields)
CagetteMembers.add_makeups_to_come_to_member_data(res)
return res return res
@staticmethod @staticmethod
def add_makeups_to_come_to_member_data(res):
if res:
cs = CagetteShift()
for idx, partner in enumerate(res):
shift_data = cs.get_shift_partner(int(partner['id']))
res[idx]['makeups_to_come'] = sum(1 for value in shift_data if value['is_makeup'])
@staticmethod
def get_attached_members(): def get_attached_members():
api = OdooAPI() api = OdooAPI()
cond = [['is_associated_people','=', True]] cond = [['is_associated_people','=', True]]
...@@ -1343,3 +1353,6 @@ class CagetteUser(models.Model): ...@@ -1343,3 +1353,6 @@ class CagetteUser(models.Model):
pass pass
return answer return answer
from shifts.models import CagetteShift
\ No newline at end of file
...@@ -43,8 +43,8 @@ function display_makeups_members() { ...@@ -43,8 +43,8 @@ function display_makeups_members() {
// Remove members with 0 makeups to do // Remove members with 0 makeups to do
ids_to_remove = []; ids_to_remove = [];
for (member_item of makeups_members) { for (let member_item of makeups_members) {
if (member_item.makeups_to_do == 0) { if (member_item.makeups_to_do === 0) {
ids_to_remove.push(member_item.id); ids_to_remove.push(member_item.id);
} }
} }
...@@ -101,23 +101,17 @@ function display_makeups_members() { ...@@ -101,23 +101,17 @@ function display_makeups_members() {
} }
}, },
{ {
data: "shift_type", data: "makeups_to_come",
title: "<div class='title_center'>Nb de points</div>", title: "<div class='title_center' title=\"Services de rattrapage à venir déjà choisis depuis l'espace membre.\">Rattrapages à venir déjà choisis</div>",
className: "dt-body-center", className: "dt-body-center",
width: "5%", width: "8%",
render: function (data, type, row) { render: function (data, type, full) {
if (data == 'ftop') { return `<b>${data}</b>`;
return row.display_ftop_points;
} else if (data == 'standard') {
return row.display_std_points;
}
return null;
} }
}, },
{ {
data: "makeups_to_do", data: "makeups_to_do",
title: "<div class='title_center'>Nb rattrapages</div>", title: "<div class='title_center' title=\"Rattrapages en attente de sélection sur l'espace membre.\">Rattrapages pas encore choisis</div>",
className: "dt-body-center", className: "dt-body-center",
width: "10%", width: "10%",
render: function (data, type, full) { render: function (data, type, full) {
...@@ -129,6 +123,21 @@ function display_makeups_members() { ...@@ -129,6 +123,21 @@ function display_makeups_members() {
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
</button>`; </button>`;
} }
},
{
data: null,
title: "<div class='title_center' title=\"Information d'interprétation délicate réservée aux utilisateurs avancés.\">Points (avancé)</div>",
className: "dt-body-center",
width: "5%",
render: function (data, type, row) {
if (data == 'ftop') {
return row.display_ftop_points;
} else if (data == 'standard') {
return row.display_std_points;
}
return null;
}
} }
], ],
aLengthMenu: [ aLengthMenu: [
...@@ -446,7 +455,8 @@ function display_possible_members() { ...@@ -446,7 +455,8 @@ function display_possible_members() {
makeups_to_do: 0, makeups_to_do: 0,
shift_type: member.shift_type, shift_type: member.shift_type,
display_std_points: member.display_std_points, display_std_points: member.display_std_points,
display_ftop_points: member.display_ftop_points display_ftop_points: member.display_ftop_points,
makeups_to_come: member.makeups_to_come
}); });
let modal_template = $("#modal_incr_makeup_counter"); let modal_template = $("#modal_incr_makeup_counter");
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="page_content"> <div class="page_content">
<div id="table_top_area"> <div id="table_top_area">
<h3>Liste des membres devant effectuer un rattrapage</h3> <h3>Liste des membres ayant au moins un rattrapage à choisir dans leur espace</h3>
<div class="table_grouped_action"> <div class="table_grouped_action">
<button type="button" class="btn--primary" id="decrement_selected_members_makeups"> <button type="button" class="btn--primary" id="decrement_selected_members_makeups">
-1 rattrapage pour les membres sélectionnés -1 rattrapage pour les membres sélectionnés
......
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