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):
template = loader.get_template('members/admin/index.html')
context = {'title': 'BDM',
'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))
def manage_makeups(request):
......
......@@ -608,7 +608,8 @@ class CagetteMember(models.Model):
try:
api.execute('res.partner', 'send_welcome_email', [partner_id])
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
# try:
# CagetteMail.sendWelcome(f['email'])
......
......@@ -55,7 +55,7 @@ $(document).ready(function() {
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();
}
});
......@@ -30,6 +30,7 @@ def index(request, exception=None):
'title': 'Espace Membre',
'COMPANY_LOGO': getattr(settings, 'COMPANY_LOGO', None),
'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),
'block_service_exchange_24h_before' : getattr(settings, 'BLOCK_SERVICE_EXCHANGE_24H_BEFORE', True),
}
......
......@@ -13,11 +13,11 @@ class CagetteStock(models.Model):
errors = []
if movement_type == 'losses':
location_dest_id = settings.LOSSES_LOC_ID
location_dest_id = getattr(settings, 'LOSSES_LOC_ID', None)
elif movement_type == 'meals':
location_dest_id = settings.MEALS_LOC_ID
location_dest_id = getattr(settings, 'MEALS_LOC_ID', None)
elif movement_type == 'autoconso':
location_dest_id = settings.AUTOCONSO_LOC_ID
location_dest_id = getattr(settings, 'AUTOCONSO_LOC_ID', None)
else:
errors.append('Type de mouvement incorrect')
return {'errors': errors}
......@@ -40,20 +40,24 @@ class CagetteStock(models.Model):
api = OdooAPI()
errors = []
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
if stock_movement_data['movement_type'] == 'losses':
picking_name = 'Pertes - '
picking_type = settings.LOSSES_PICKING_TYPE_ID
destination = settings.LOSSES_LOC_ID
picking_type = getattr(settings, 'LOSSES_PICKING_TYPE_ID', None)
destination = getattr(settings, 'LOSSES_LOC_ID', None)
elif stock_movement_data['movement_type'] == 'meals':
picking_name = 'Repas Salarié - '
picking_type = settings.MEALS_PICKING_TYPE_ID
destination = settings.MEALS_LOC_ID
picking_type = getattr(settings, 'MEALS_PICKING_TYPE_ID', None)
destination = getattr(settings, 'MEALS_LOC_ID', None)
elif stock_movement_data['movement_type'] == 'autoconso':
picking_name = 'Autoconsommation - '
picking_type = settings.AUTOCONSO_PICKING_TYPE_ID
destination = settings.AUTOCONSO_LOC_ID
picking_type = getattr(settings, 'AUTOCONSO_PICKING_TYPE_ID', None)
destination = getattr(settings, 'AUTOCONSO_LOC_ID', None)
else:
errors.append('Type de mouvement incorrect')
return {'errors': errors, 'picking_id': picking}
......@@ -65,7 +69,7 @@ class CagetteStock(models.Model):
'company_id': 1,
'name': picking_name,
'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
'move_lines': [],
'pack_operation_ids': [],
......@@ -88,7 +92,7 @@ class CagetteStock(models.Model):
"product_uom": p['uom_id'],
"product_uom_qty": str(qty),
"picking_type_id": picking_type,
"location_id": settings.STOCK_LOC_ID,
"location_id": stock_loc_id,
"location_dest_id": destination,
"state": "draft",
"scrapped": False,
......@@ -102,7 +106,7 @@ class CagetteStock(models.Model):
{
"product_qty": str(qty),
"qty_done": str(qty),
"location_id": settings.STOCK_LOC_ID,
"location_id": stock_loc_id,
"location_dest_id": destination,
"product_id": p['id'],
"name": p['name'],
......
......@@ -12,7 +12,8 @@ from django.shortcuts import render
def movements_page(request):
"""Page de selection de produits pour créer des mouvements de stock"""
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')
......@@ -21,7 +22,8 @@ def movements_page(request):
def movements_view(request):
"""Page d'extraction des mouvements de stocks"""
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')
......
......@@ -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-arrow-right"></i></span> #}
</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>
......
......@@ -32,9 +32,13 @@
<div class="pairs_info">
<span>
<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...)
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.
{% endif %}
</span>
</div>
......
......@@ -154,6 +154,7 @@
"extra_shift_done": parseInt("{{partnerData.extra_shift_done}}", 10)
};
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}}';
const canAddShift = {{canAddShift}};
const extension_duration = {{extension_duration}};
......
......@@ -31,10 +31,12 @@
Autoconsommation
<span class="movement_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button><br>
{% if meals_loc_id %}
<button type="button" class="btn--primary movement_type_button" id="meals_type_button">
Repas salariés
<span class="movement_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button>
{% endif %}
</div>
</div>
......
......@@ -30,7 +30,9 @@
<select class="select_movement_element select_movement_input" id="movement_type_selector" name="">
<option value="">-- Choisissez un type de mouvement --</option>
<option value="losses">Pertes</option>
{% if meals_loc_id %}
<option value="meals">Repas salariés</option>
{% endif %}
<option value="autoconso">Autoconsomation</option>
</select>
<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