Commit d785e9a4 authored by Patrick's avatar Patrick

Also display order without delivery point -> The customer has not selected it yet

parent e3815ebc
......@@ -271,6 +271,8 @@ class PermanenceInPreparationAdmin(TranslatableAdmin):
user_message_level = messages.WARNING
self.message_user(request, user_message, user_message_level)
return
# Also display order without delivery point -> The customer has not selected it yet
deliveries_to_be_exported.append(None)
else:
deliveries_to_be_exported = None
response = None
......
......@@ -41,6 +41,43 @@ def export_abstract(permanence, deliveries_id=None, group=False, wb=None):
(_('email'), 35),
]
wb, ws = new_portrait_a4_sheet(wb, permanence, EMPTY_STRING, header=header, add_print_title=False)
customer_set = Customer.objects.filter(
customerinvoice__permanence_id=permanence.id,
represent_this_buyinggroup=False,
customerinvoice__delivery__isnull=True
)
for customer in customer_set:
invoice = CustomerInvoice.objects.filter(
permanence=permanence, customer=customer
).order_by('?').first()
if invoice is not None and invoice.total_price_with_tax.amount != DECIMAL_ZERO:
customer.preparation_order = preparation_order
customer.save(update_fields=['preparation_order'])
preparation_order += 1
row = [
"N/A",
" %d - %s" % (customer.preparation_order, customer.long_basket_name),
customer.phone1,
customer.phone2,
invoice.total_price_with_tax.amount,
# Used to send mail to customer with an order (via copy-paste to mail)
";".join(
[customer.user.email, customer.email2, EMPTY_STRING]
) if customer.email2 else ";".join(
[customer.user.email, customer.email2]
)
]
for col_num in range(len(row)):
c = ws.cell(row=row_num, column=col_num)
c.value = row[col_num]
if col_num == 4:
c.style.number_format.format_code = repanier.apps.REPANIER_SETTINGS_CURRENCY_XLSX
else:
c.style.number_format.format_code = NumberFormat.FORMAT_TEXT
c.style.alignment.wrap_text = False
if row_num % 2 == 0:
c.style.borders.bottom.border_style = Border.BORDER_THIN
row_num += 1
for delivery_ref, delivery in enumerate(DeliveryBoard.objects.filter(id__in=deliveries_id).order_by("id")):
customer_set = Customer.objects.filter(
customerinvoice__permanence_id=permanence.id,
......@@ -303,9 +340,8 @@ def export_customer_label(permanence, deliveries_id=None, wb=None):
if row_num > 0:
ws.column_dimensions[get_column_letter(1)].width = 120
return wb
return
return wb
def customer_label(customer_identifier, placements, row_num, 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