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):
p[k] = ''
# 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]]]
f = ['id', 'sort_order']
res_sortorder = api.search_read('product.shelfs', c, f)
if res_sortorder:
p['shelf_sortorder'] = res_sortorder[0]['sort_order']
else:
p['shelf_sortorder'] = ''
res['data'] = pdts
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) + ")"
return res
......
......@@ -313,7 +313,8 @@ def admin(request):
""" Administration des membres """
template = loader.get_template('members/admin/index.html')
context = {'title': 'BDM',
'module': 'Membres'}
'module': 'Membres',
'admin_binome_active': getattr(settings, 'ADMIN_BINOME_ACTIVE', True),}
return HttpResponse(template.render(context, request))
def manage_makeups(request):
......
......@@ -284,7 +284,6 @@ function create_pair(payload) {
data.responseJSON.errors.map(function(error) {
message += ('\n' + error);
return null;
});
}
......
......@@ -1079,7 +1079,7 @@ function generate_inventory() {
} else {
$('#do_inventory').empty()
.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'};
if (typeof data.responseJSON != 'undefined' && typeof data.responseJSON.error != 'undefined') {
......
......@@ -123,7 +123,7 @@ def get_orders_attachment(request):
for item in res:
if 'error' in item:
return JsonResponse(res, status=500)
return JsonResponse(res, status=500, safe=False)
return JsonResponse({'res': res})
......@@ -133,6 +133,7 @@ def export_one(request, oid):
oid = int(oid)
order = Order(oid)
order_data = order.export()
if ('success' in order_data) and (order_data['success'] is True):
now = datetime.datetime.now()
taxes = 0
......@@ -176,7 +177,7 @@ def export_one(request, oid):
# return response
except Exception as e:
msg = str(e)
coop_logger.error("Order export error : %s", msg)
return JsonResponse({"msg": msg}, safe=False)
def export_regex(request, string):
......@@ -258,4 +259,4 @@ def print_product_labels(request):
res['errors'].append(pres)
except Exception as e:
res['error_ext'] = str(e)
return JsonResponse({'res': res}, safe=False)
\ No newline at end of file
return JsonResponse({'res': res}, safe=False)
......@@ -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
- ADMIN_BINOME_ACTIVE = False
By defaut, True. Show "Gestion des binômes" in bdm admin
### Miscellious
- EXPORT_COMPTA_FORMAT = 'Quadratus'
......
......@@ -88,7 +88,7 @@ class FieldsView(View):
u"""Nous allons retourner les attributs Odoo correspondants."""
entity = request.POST.get("entity", "")
fields = []
if len(entity) > 1:
if getattr(settings, 'APP_ENV', "prod") == "dev" and len(entity) > 1:
api = OdooAPI()
fields = api.get_entity_fields(entity)
template = loader.get_template('common/entity_fields.html')
......
......@@ -591,4 +591,4 @@ class Shelfs(models.Model):
except Exception as e:
res['error'] = str(e)
coop_logger.error("Rayons, make_products_shelf_links : %s", str(e))
return res
\ No newline at end of file
return res
......@@ -373,7 +373,12 @@ class CagetteShift(models.Model):
def member_can_have_delay(self, partner_id):
""" 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):
""" Add/remove points """
......
......@@ -29,10 +29,12 @@
Gestion des présences
<span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button><br>
{% if admin_binome_active %}
<button type="button" class="btn--primary management_type_button" id="manage_attached_button">
Gestion des binômes
<span class="management_type_button_icons"><i class="fas fa-arrow-right"></i></span>
</button><br>
{% endif %}
<button type="button" class="btn--primary management_type_button" id="manage_regular_shifts_button">
Gestion des créneaux
<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