Commit 05f41995 authored by Patrick's avatar Patrick

Slugify xlsx sheet names

parent 4ec3535d
......@@ -98,7 +98,7 @@ def worksheet_set_header(worksheet, header):
def get_validation_formula(wb=None, valid_values=None):
if valid_values:
ws_dv_name = cap("%s" % (_("data validation")), 31)
ws_dv_name = cap(slugify("%s" % (_("data validation"))), 31)
ws_dv = wb.get_sheet_by_name(ws_dv_name)
if ws_dv is None:
ws_dv = wb.create_sheet(index=0)
......
......@@ -1323,11 +1323,11 @@ def admin_customer_export(permanence, deliveries_id=None):
)
wb = export_preparation(permanence=permanence, deliveries_id=deliveries_id, wb=wb)
if wb is not None:
ws_preparation_title = cap("%s" % (_("Preparation")), 31)
ws_preparation_title = cap(slugify("%s" % _("Preparation")), 31)
wb = export_customer(
permanence=permanence, deliveries_id=deliveries_id, wb=wb, ws_preparation_title=ws_preparation_title
)
ws_customer_title = cap("%s" % (_('Customer check')), 31)
ws_customer_title = cap(slugify("%s" % _('Customer check')), 31)
wb = export_customer(permanence=permanence, deliveries_id=deliveries_id, deposit=True, wb=wb)
else:
ws_customer_title = None
......
......@@ -720,14 +720,14 @@ def handle_uploaded_file(request, permanences, file_to_import):
permanence = permanences.first()
if permanence is not None:
if permanence.status == PERMANENCE_SEND:
ws = wb.get_sheet_by_name(cap("%s" % (permanence), 31))
ws = wb.get_sheet_by_name(cap(slugify("%s" % (permanence)), 31))
error, error_msg = import_purchase_sheet(
ws, permanence=permanence,
customer_2_id_dict=customer_2_id_dict,
producer_2_id_dict=producer_2_id_dict
)
if error:
error_msg = cap("%s" % (permanence), 31) + " > " + error_msg
error_msg = cap(slugify("%s" % (permanence)), 31) + " > " + error_msg
else:
error = True
error_msg = _("The permanence has already been invoiced.")
......
......@@ -73,7 +73,7 @@ def export_permanence_stock(permanence, deliveries_id=None, customer_price=False
deliveries_ws.append(ws_sc_name)
break
else:
ws_sc_name = cap(ws_customer_title, 31)
ws_sc_name = cap(slugify(ws_customer_title), 31)
for sheet in wb.worksheets:
if ws_sc_name == sheet.title:
deliveries_ws.append(ws_sc_name)
......@@ -470,7 +470,7 @@ def handle_uploaded_file(request, producers, file_to_import):
error_msg = None
wb = load_workbook(file_to_import)
if wb is not None:
ws = wb.get_sheet_by_name(cap("%s" % _('Current stock'), 31))
ws = wb.get_sheet_by_name(cap(slugify("%s" % _('Current stock')), 31))
if ws is not None:
error, error_msg = import_producer_stock(
ws,
......
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