Commit 00a490e0 by François C.

For supercoop usage improvements

parent 2804d911
Pipeline #2475 passed with stage
in 1 minute 25 seconds
...@@ -315,7 +315,8 @@ def admin(request): ...@@ -315,7 +315,8 @@ def admin(request):
template = loader.get_template('members/admin/index.html') template = loader.get_template('members/admin/index.html')
context = {'title': 'BDM', context = {'title': 'BDM',
'module': 'Membres', 'module': 'Membres',
'admin_binome_active': getattr(settings, 'ADMIN_BINOME_ACTIVE', True),} 'admin_binome_active': getattr(settings, 'ADMIN_BINOME_ACTIVE', True),
'other_bdm_button': getattr(settings, 'OTHER_BDM_BUTTON', None)}
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))
def manage_makeups(request): def manage_makeups(request):
......
...@@ -608,7 +608,8 @@ class CagetteMember(models.Model): ...@@ -608,7 +608,8 @@ class CagetteMember(models.Model):
try: try:
api.execute('res.partner', 'send_welcome_email', [partner_id]) api.execute('res.partner', 'send_welcome_email', [partner_id])
except Exception as e: except Exception as e:
res['error'] = 'Erreur envoie mail invitation' res['error'] = 'Erreur envoi mail Bienvenue'
coop_logger.error(" Erreur envoi mail Bienvenue: %s", str(e))
# from outils.common import CagetteMail # from outils.common import CagetteMail
# try: # try:
# CagetteMail.sendWelcome(f['email']) # CagetteMail.sendWelcome(f['email'])
......
...@@ -55,7 +55,7 @@ $(document).ready(function() { ...@@ -55,7 +55,7 @@ $(document).ready(function() {
toggleHeader(); toggleHeader();
}); });
if (partner_data.is_associated_people === "True" && block_actions_for_attached_people === "True") { if (partner_data.is_associated_people === "True" && (block_actions_for_attached_people === "True" || always_show_pair_info === "True")) {
$(".pairs_info").show(); $(".pairs_info").show();
} }
}); });
...@@ -30,6 +30,7 @@ def index(request, exception=None): ...@@ -30,6 +30,7 @@ def index(request, exception=None):
'title': 'Espace Membre', 'title': 'Espace Membre',
'COMPANY_LOGO': getattr(settings, 'COMPANY_LOGO', None), 'COMPANY_LOGO': getattr(settings, 'COMPANY_LOGO', None),
'block_actions_for_attached_people' : getattr(settings, 'BLOCK_ACTIONS_FOR_ATTACHED_PEOPLE', True), 'block_actions_for_attached_people' : getattr(settings, 'BLOCK_ACTIONS_FOR_ATTACHED_PEOPLE', True),
'always_show_pair_info': getattr(settings, 'ALWAYS_SHOW_PAIR_INFO', False),
'permanent_message': getattr(settings, 'PERMANENT_MESSAGE_BELOW_CONNECTION_FIELDS', None), 'permanent_message': getattr(settings, 'PERMANENT_MESSAGE_BELOW_CONNECTION_FIELDS', None),
'block_service_exchange_24h_before' : getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', True), 'block_service_exchange_24h_before' : getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', True),
} }
......
...@@ -13,11 +13,11 @@ class CagetteStock(models.Model): ...@@ -13,11 +13,11 @@ class CagetteStock(models.Model):
errors = [] errors = []
if movement_type == 'losses': if movement_type == 'losses':
location_dest_id = settings.LOSSES_LOC_ID location_dest_id = getattr(settings, 'LOSSES_LOC_ID', None)
elif movement_type == 'meals': elif movement_type == 'meals':
location_dest_id = settings.MEALS_LOC_ID location_dest_id = getattr(settings, 'MEALS_LOC_ID', None)
elif movement_type == 'autoconso': elif movement_type == 'autoconso':
location_dest_id = settings.AUTOCONSO_LOC_ID location_dest_id = getattr(settings, 'AUTOCONSO_LOC_ID', None)
else: else:
errors.append('Type de mouvement incorrect') errors.append('Type de mouvement incorrect')
return {'errors': errors} return {'errors': errors}
...@@ -41,19 +41,23 @@ class CagetteStock(models.Model): ...@@ -41,19 +41,23 @@ class CagetteStock(models.Model):
errors = [] errors = []
picking = False picking = False
stock_loc_id = getattr(settings, 'STOCK_LOC_ID', None)
if stock_loc_id is None:
return {'errors': 'No stock_loc_id', 'picking_id': None}
# Set stock movement details according to destination # Set stock movement details according to destination
if stock_movement_data['movement_type'] == 'losses': if stock_movement_data['movement_type'] == 'losses':
picking_name = 'Pertes - ' picking_name = 'Pertes - '
picking_type = settings.LOSSES_PICKING_TYPE_ID picking_type = getattr(settings, 'LOSSES_PICKING_TYPE_ID', None)
destination = settings.LOSSES_LOC_ID destination = getattr(settings, 'LOSSES_LOC_ID', None)
elif stock_movement_data['movement_type'] == 'meals': elif stock_movement_data['movement_type'] == 'meals':
picking_name = 'Repas Salarié - ' picking_name = 'Repas Salarié - '
picking_type = settings.MEALS_PICKING_TYPE_ID picking_type = getattr(settings, 'MEALS_PICKING_TYPE_ID', None)
destination = settings.MEALS_LOC_ID destination = getattr(settings, 'MEALS_LOC_ID', None)
elif stock_movement_data['movement_type'] == 'autoconso': elif stock_movement_data['movement_type'] == 'autoconso':
picking_name = 'Autoconsommation - ' picking_name = 'Autoconsommation - '
picking_type = settings.AUTOCONSO_PICKING_TYPE_ID picking_type = getattr(settings, 'AUTOCONSO_PICKING_TYPE_ID', None)
destination = settings.AUTOCONSO_LOC_ID destination = getattr(settings, 'AUTOCONSO_LOC_ID', None)
else: else:
errors.append('Type de mouvement incorrect') errors.append('Type de mouvement incorrect')
return {'errors': errors, 'picking_id': picking} return {'errors': errors, 'picking_id': picking}
...@@ -65,7 +69,7 @@ class CagetteStock(models.Model): ...@@ -65,7 +69,7 @@ class CagetteStock(models.Model):
'company_id': 1, 'company_id': 1,
'name': picking_name, 'name': picking_name,
'picking_type_id' : picking_type, # mouvement type 'picking_type_id' : picking_type, # mouvement type
'location_id': settings.STOCK_LOC_ID, # movement origin 'location_id': stock_loc_id, # movement origin
'location_dest_id': destination, # movement dest 'location_dest_id': destination, # movement dest
'move_lines': [], 'move_lines': [],
'pack_operation_ids': [], 'pack_operation_ids': [],
...@@ -88,7 +92,7 @@ class CagetteStock(models.Model): ...@@ -88,7 +92,7 @@ class CagetteStock(models.Model):
"product_uom": p['uom_id'], "product_uom": p['uom_id'],
"product_uom_qty": str(qty), "product_uom_qty": str(qty),
"picking_type_id": picking_type, "picking_type_id": picking_type,
"location_id": settings.STOCK_LOC_ID, "location_id": stock_loc_id,
"location_dest_id": destination, "location_dest_id": destination,
"state": "draft", "state": "draft",
"scrapped": False, "scrapped": False,
...@@ -102,7 +106,7 @@ class CagetteStock(models.Model): ...@@ -102,7 +106,7 @@ class CagetteStock(models.Model):
{ {
"product_qty": str(qty), "product_qty": str(qty),
"qty_done": str(qty), "qty_done": str(qty),
"location_id": settings.STOCK_LOC_ID, "location_id": stock_loc_id,
"location_dest_id": destination, "location_dest_id": destination,
"product_id": p['id'], "product_id": p['id'],
"name": p['name'], "name": p['name'],
......
...@@ -12,7 +12,8 @@ from django.shortcuts import render ...@@ -12,7 +12,8 @@ from django.shortcuts import render
def movements_page(request): def movements_page(request):
"""Page de selection de produits pour créer des mouvements de stock""" """Page de selection de produits pour créer des mouvements de stock"""
context = { context = {
'title': 'Mouvements de stock' 'title': 'Mouvements de stock',
'meals_loc_id': getattr(settings, 'MEALS_LOC_ID', None)
} }
template = loader.get_template('stock/stock_movements.html') template = loader.get_template('stock/stock_movements.html')
...@@ -21,7 +22,8 @@ def movements_page(request): ...@@ -21,7 +22,8 @@ def movements_page(request):
def movements_view(request): def movements_view(request):
"""Page d'extraction des mouvements de stocks""" """Page d'extraction des mouvements de stocks"""
context = { context = {
'title': 'Mouvements de stock' 'title': 'Mouvements de stock',
'meals_loc_id': getattr(settings, 'MEALS_LOC_ID', None)
} }
template = loader.get_template('stock/stock_movements_view.html') template = loader.get_template('stock/stock_movements_view.html')
......
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
<span class="management_type_button_icons"><i class="fas fa-wrench"></i></span> <span class="management_type_button_icons"><i class="fas fa-wrench"></i></span>
{# <span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span> #} {# <span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span> #}
</button><br> </button><br>
{% if other_bdm_button %}
<a class="btn--primary management_type_button" href="{{other_bdm_button.url}}" target="_blank">
{{other_bdm_button.title}}
<span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</a><br>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -32,9 +32,13 @@ ...@@ -32,9 +32,13 @@
<div class="pairs_info"> <div class="pairs_info">
<span> <span>
<i class="fas fa-exclamation-circle"></i> Je suis en binôme. <i class="fas fa-exclamation-circle"></i> Je suis en binôme.
{% if not block_actions_for_attached_people %}
Je peux changer les services mais pas le créneau.
{% else %}
Toutes les actions (changement de service, choix d'un rattrapage...) Toutes les actions (changement de service, choix d'un rattrapage...)
ne sont faisables que sur l'espace membre du <b>binôme principal</b>. ne sont faisables que sur l'espace membre du <b>binôme principal</b>.
Dans mon espace membre, les infos ne sont visibles qu'en lecture seule. Dans mon espace membre, les infos ne sont visibles qu'en lecture seule.
{% endif %}
</span> </span>
</div> </div>
......
...@@ -154,6 +154,7 @@ ...@@ -154,6 +154,7 @@
"extra_shift_done": parseInt("{{partnerData.extra_shift_done}}", 10) "extra_shift_done": parseInt("{{partnerData.extra_shift_done}}", 10)
}; };
var block_actions_for_attached_people = '{{block_actions_for_attached_people}}'; var block_actions_for_attached_people = '{{block_actions_for_attached_people}}';
let always_show_pair_info = '{{always_show_pair_info}}';
var block_service_exchange_24h_before = '{{block_service_exchange_24h_before}}'; var block_service_exchange_24h_before = '{{block_service_exchange_24h_before}}';
const canAddShift = {{canAddShift}}; const canAddShift = {{canAddShift}};
const extension_duration = {{extension_duration}}; const extension_duration = {{extension_duration}};
......
...@@ -31,10 +31,12 @@ ...@@ -31,10 +31,12 @@
Autoconsommation Autoconsommation
<span class="movement_type_button_icons"><i class="fas fa-arrow-right"></i></span> <span class="movement_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button><br> </button><br>
{% if meals_loc_id %}
<button type="button" class="btn--primary movement_type_button" id="meals_type_button"> <button type="button" class="btn--primary movement_type_button" id="meals_type_button">
Repas salariés Repas salariés
<span class="movement_type_button_icons"><i class="fas fa-arrow-right"></i></span> <span class="movement_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button> </button>
{% endif %}
</div> </div>
</div> </div>
......
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
<select class="select_movement_element select_movement_input" id="movement_type_selector" name=""> <select class="select_movement_element select_movement_input" id="movement_type_selector" name="">
<option value="">-- Choisissez un type de mouvement --</option> <option value="">-- Choisissez un type de mouvement --</option>
<option value="losses">Pertes</option> <option value="losses">Pertes</option>
{% if meals_loc_id %}
<option value="meals">Repas salariés</option> <option value="meals">Repas salariés</option>
{% endif %}
<option value="autoconso">Autoconsomation</option> <option value="autoconso">Autoconsomation</option>
</select> </select>
<p class="select_movement_element">De : <input type="text" id="from" class="select_movement_input"></p> <p class="select_movement_element">De : <input type="text" id="from" class="select_movement_input"></p>
......
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