Commit 2a9168ae by François C.

Merge branch 'adaptation_supercoop' into adaptation_supercoop_supercafoutch

parents 191dc696 1c6a58c9
Pipeline #2361 passed with stage
in 1 minute 22 seconds
...@@ -90,16 +90,19 @@ class CagetteInventory(models.Model): ...@@ -90,16 +90,19 @@ class CagetteInventory(models.Model):
p[k] = '' p[k] = ''
# Get shelf sortorder # Get shelf sortorder
if p['shelf_id'] is not False: if p['shelf_id'] is not False and len(p['shelf_id']) > 0:
c = [['id', '=', p['shelf_id'][0]]] c = [['id', '=', p['shelf_id'][0]]]
f = ['id', 'sort_order'] f = ['id', 'sort_order']
res_sortorder = api.search_read('product.shelfs', c, f) res_sortorder = api.search_read('product.shelfs', c, f)
if res_sortorder: if res_sortorder:
p['shelf_sortorder'] = res_sortorder[0]['sort_order'] p['shelf_sortorder'] = res_sortorder[0]['sort_order']
else:
p['shelf_sortorder'] = ''
res['data'] = pdts res['data'] = pdts
except Exception as e: except Exception as e:
coop_logger.error("get_custom_list_products -> Erreur lors de la récupération des produits : %s", str(e))
res['error'] = "Erreur lors de la récupération des produits (" + str(e) + ")" res['error'] = "Erreur lors de la récupération des produits (" + str(e) + ")"
return res return res
......
...@@ -313,7 +313,8 @@ def admin(request): ...@@ -313,7 +313,8 @@ def admin(request):
""" Administration des membres """ """ Administration des membres """
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),}
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))
def manage_makeups(request): def manage_makeups(request):
......
...@@ -284,7 +284,6 @@ function create_pair(payload) { ...@@ -284,7 +284,6 @@ function create_pair(payload) {
data.responseJSON.errors.map(function(error) { data.responseJSON.errors.map(function(error) {
message += ('\n' + error); message += ('\n' + error);
return null; return null;
}); });
} }
......
...@@ -1079,7 +1079,7 @@ function generate_inventory() { ...@@ -1079,7 +1079,7 @@ function generate_inventory() {
} else { } else {
$('#do_inventory').empty() $('#do_inventory').empty()
.append(`Faire un inventaire`); .append(`Faire un inventaire`);
let msg = "erreur serveur lors de la création de l'inventaire". let msg = "erreur serveur lors de la création de l'inventaire",
err = {msg: msg, ctx: 'generate_inventory'}; err = {msg: msg, ctx: 'generate_inventory'};
if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') { if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
......
...@@ -123,7 +123,7 @@ def get_orders_attachment(request): ...@@ -123,7 +123,7 @@ def get_orders_attachment(request):
for item in res: for item in res:
if 'error' in item: if 'error' in item:
return JsonResponse(res, status=500) return JsonResponse(res, status=500, safe=False)
return JsonResponse({'res': res}) return JsonResponse({'res': res})
...@@ -133,6 +133,7 @@ def export_one(request, oid): ...@@ -133,6 +133,7 @@ def export_one(request, oid):
oid = int(oid) oid = int(oid)
order = Order(oid) order = Order(oid)
order_data = order.export() order_data = order.export()
if ('success' in order_data) and (order_data['success'] is True): if ('success' in order_data) and (order_data['success'] is True):
now = datetime.datetime.now() now = datetime.datetime.now()
taxes = 0 taxes = 0
...@@ -176,7 +177,7 @@ def export_one(request, oid): ...@@ -176,7 +177,7 @@ def export_one(request, oid):
# return response # return response
except Exception as e: except Exception as e:
msg = str(e) msg = str(e)
coop_logger.error("Order export error : %s", msg)
return JsonResponse({"msg": msg}, safe=False) return JsonResponse({"msg": msg}, safe=False)
def export_regex(request, string): def export_regex(request, string):
......
...@@ -432,6 +432,10 @@ ...@@ -432,6 +432,10 @@
If True, in BDM Admin manage shift template, on the calendar when subscribing a partner to a shift, "Volant" button is included If True, in BDM Admin manage shift template, on the calendar when subscribing a partner to a shift, "Volant" button is included
- ADMIN_BINOME_ACTIVE = False
By defaut, True. Show "Gestion des binômes" in bdm admin
### Miscellious ### Miscellious
- EXPORT_COMPTA_FORMAT = 'Quadratus' - EXPORT_COMPTA_FORMAT = 'Quadratus'
......
...@@ -88,7 +88,7 @@ class FieldsView(View): ...@@ -88,7 +88,7 @@ class FieldsView(View):
u"""Nous allons retourner les attributs Odoo correspondants.""" u"""Nous allons retourner les attributs Odoo correspondants."""
entity = request.POST.get("entity", "") entity = request.POST.get("entity", "")
fields = [] fields = []
if len(entity) > 1: if getattr(settings, 'APP_ENV', "prod") == "dev" and len(entity) > 1:
api = OdooAPI() api = OdooAPI()
fields = api.get_entity_fields(entity) fields = api.get_entity_fields(entity)
template = loader.get_template('common/entity_fields.html') template = loader.get_template('common/entity_fields.html')
......
...@@ -373,7 +373,12 @@ class CagetteShift(models.Model): ...@@ -373,7 +373,12 @@ class CagetteShift(models.Model):
def member_can_have_delay(self, partner_id): def member_can_have_delay(self, partner_id):
""" Can a member have a delay? """ """ Can a member have a delay? """
return self.o_api.execute('res.partner', 'can_have_extension', [partner_id]) answer = False
try:
answer = self.o_api.execute('res.partner', 'can_have_extension', [partner_id])
except Exception as e:
coop_logger.error("member_can_have_delay : %s", str(e))
return answer
def update_counter_event(self, fields): def update_counter_event(self, fields):
""" Add/remove points """ """ Add/remove points """
......
...@@ -29,10 +29,12 @@ ...@@ -29,10 +29,12 @@
Gestion des présences Gestion des présences
<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 admin_binome_active %}
<button type="button" class="btn--primary management_type_button" id="manage_attached_button"> <button type="button" class="btn--primary management_type_button" id="manage_attached_button">
Gestion des binômes Gestion des binômes
<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>
{% endif %}
<button type="button" class="btn--primary management_type_button" id="manage_regular_shifts_button"> <button type="button" class="btn--primary management_type_button" id="manage_regular_shifts_button">
Gestion des créneaux Gestion des créneaux
<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>
......
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