Commit a91c4f18 by François C.

Fix bdm admin member search

parent 5659046c
Pipeline #2375 failed with stage
in 1 minute 43 seconds
...@@ -794,7 +794,7 @@ class CagetteMember(models.Model): ...@@ -794,7 +794,7 @@ class CagetteMember(models.Model):
else: else:
cond.append(['is_associated_people', '=', False]) cond.append(['is_associated_people', '=', False])
# cond.append(['cooperative_state', '!=', 'unsubscribed']) # cond.append(['cooperative_state', '!=', 'unsubscribed'])
if search_type == "full" or search_type == 'members': if search_type == "full" or search_type == 'members' or search_type == "manage_shift_registrations":
fields = CagetteMember.m_default_fields fields = CagetteMember.m_default_fields
if not shift_id is None: if not shift_id is None:
CagetteMember.m_default_fields.append('tmpl_reg_line_ids') CagetteMember.m_default_fields.append('tmpl_reg_line_ids')
...@@ -840,7 +840,7 @@ class CagetteMember(models.Model): ...@@ -840,7 +840,7 @@ class CagetteMember(models.Model):
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'] fields = fields + ['id', 'makeups_to_do', 'cooperative_state','parent_name']
res = api.search_read('res.partner', cond, fields) res = api.search_read('res.partner', cond, fields)
if res: if res:
...@@ -853,6 +853,9 @@ class CagetteMember(models.Model): ...@@ -853,6 +853,9 @@ class CagetteMember(models.Model):
partner['shift_template_id'] = shift_template_reg[0]['shift_template_id'] partner['shift_template_id'] = shift_template_reg[0]['shift_template_id']
else: else:
partner['shift_template_id'] = None partner['shift_template_id'] = None
if not partner['parent_name'] is False:
partner['name'] += ' (suppléant.e de son binôme ' + partner['parent_name'] + ')'
del partner['parent_name']
return res return res
else: else:
......
...@@ -293,7 +293,7 @@ $(document).ready(function() { ...@@ -293,7 +293,7 @@ $(document).ready(function() {
let search_str = $('#search_member_input').val(); let search_str = $('#search_member_input').val();
$.ajax({ $.ajax({
url: '/members/search/' + search_str, url: `/members/search/${search_str}?search_type=shift_template_data`,
dataType : 'json', dataType : 'json',
success: function(data) { success: function(data) {
$('#partner_data_area').hide(); $('#partner_data_area').hide();
......
...@@ -231,7 +231,7 @@ $(document).ready(function() { ...@@ -231,7 +231,7 @@ $(document).ready(function() {
let search_str = $('#search_member_input').val(); let search_str = $('#search_member_input').val();
$.ajax({ $.ajax({
url: '/members/search/' + search_str, url: `/members/search/${search_str}?search_type=manage_shift_registrations`,
dataType : 'json', dataType : 'json',
success: function(data) { success: function(data) {
members_search_results = []; members_search_results = [];
......
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