Esempio n. 1
0
 def export_purchases(self, request, permanence_id, permanence=None):
     wb = export_purchase(permanence=permanence, wb=None)
     if wb is not None:
         response = HttpResponse(
             content_type=
             "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
         )
         response[
             "Content-Disposition"] = "attachment; filename={0}-{1}.xlsx".format(
                 _("Invoices"), permanence)
         wb.save(response)
         return response
     else:
         return HttpResponseRedirect(self.get_redirect_to_change_list_url())
Esempio n. 2
0
 def export_xlsx(self, request, permanence_qs):
     permanence = permanence_qs.first()
     if permanence.status != PERMANENCE_SEND:
         user_message = _("The status of %(permanence)s prohibit you to perform this action.") % {
             'permanence': permanence}
         user_message_level = messages.ERROR
         self.message_user(request, user_message, user_message_level)
         return
     wb = export_purchase(permanence=permanence, wb=None)
     if wb is not None:
         response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
         response['Content-Disposition'] = "attachment; filename={0}-{1}.xlsx".format(
             _("Invoices"),
             permanence
         )
         wb.save(response)
         return response
     else:
         return
Esempio n. 3
0
 def export_xlsx(self, request, permanence_qs):
     permanence = permanence_qs.first()
     if permanence.status != PERMANENCE_SEND:
         user_message = _("The status of %(permanence)s prohibit you to perform this action.") % {
             'permanence': permanence}
         user_message_level = messages.ERROR
         self.message_user(request, user_message, user_message_level)
         return
     wb = export_purchase(permanence=permanence, wb=None)
     if wb is not None:
         response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
         response['Content-Disposition'] = "attachment; filename={0}-{1}.xlsx".format(
             _("Invoices"),
             permanence
         )
         wb.save(response)
         return response
     else:
         return
Esempio n. 4
0
 def export_xlsx(self, request, permanence_qs):
     permanence = permanence_qs.first()
     if permanence is None or permanence.status != PERMANENCE_SEND:
         user_message = _("Action canceled by the system.")
         user_message_level = messages.ERROR
         self.message_user(request, user_message, user_message_level)
         return
     wb = export_purchase(permanence=permanence, wb=None)
     if wb is not None:
         response = HttpResponse(
             content_type=
             'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
         )
         response[
             'Content-Disposition'] = "attachment; filename={0}-{1}.xlsx".format(
                 slugify(_("Invoices")), slugify(permanence))
         wb.save(response)
         return response
     else:
         return