Exemplo n.º 1
0
 def create_pdf(self, request, queryset):
     from koalixcrm.crm.views.pdfexport import PDFExportView
     for obj in queryset:
         response = PDFExportView.export_pdf(
             self, request, obj,
             ("/admin/crm/" + obj.__class__.__name__.lower() + "/"))
         return response
Exemplo n.º 2
0
def create_work_report(calling_model_admin, request, queryset):
    try:
        if request.POST.get('post'):
            if 'create_pdf' in request.POST:
                create_work_report_form = CreateWorkReportForm(request.POST)
                if create_work_report_form.is_valid():
                    for obj in queryset:
                        return PDFExportView.export_pdf(
                            calling_model_admin=calling_model_admin,
                            request=request,
                            source=obj,
                            redirect_to="/admin/",
                            template_to_use=obj.user.default_template_set.work_report_template,
                            date_from=create_work_report_form.cleaned_data["range_from"],
                            date_to=create_work_report_form.cleaned_data["range_to"])
        else:
            datetime_now = datetime.datetime.today()
            range_from_date = (datetime_now - datetime.timedelta(days=30)).date()
            range_to_date = datetime_now.date()
            create_work_report_form = CreateWorkReportForm(initial={'range_from': range_from_date,
                                                                    'range_to': range_to_date})
            c = {'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
                 'queryset': queryset,
                 'form': create_work_report_form}
            c.update(csrf(request))
            return render(request, 'crm/admin/create_work_report.html', c)
    except TooManyUserExtensionsAvailable:
        raise Http404
Exemplo n.º 3
0
def create_work_report(calling_model_admin, request, queryset):
    try:
        if request.POST.get('post'):
            if 'create_pdf' in request.POST:
                create_work_report_form = CreateWorkReportForm(request.POST)
                if create_work_report_form.is_valid():
                    for obj in queryset:
                        return PDFExportView.export_pdf(calling_model_admin=calling_model_admin,
                                                        request=request,
                                                        source=obj,
                                                        redirect_to="/admin/",
                                                        template_to_use=obj.default_template_set.work_report_template,
                                                        date_from=create_work_report_form.cleaned_data["range_from"],
                                                        date_to=create_work_report_form.cleaned_data["range_to"])
        else:
            datetime_now = datetime.datetime.today()
            range_from_date = (datetime_now - datetime.timedelta(days=30)).date()
            range_to_date = datetime_now.date()
            create_work_report_form = CreateWorkReportForm(initial={'range_from': range_from_date,
                                                                    'range_to': range_to_date})
            c = {'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
                 'queryset': queryset,
                 'form': create_work_report_form}
            c.update(csrf(request))
            return render(request, 'crm/admin/create_work_report.html', c)
    except TooManyUserExtensionsAvailable:
        raise Http404
Exemplo n.º 4
0
 def create_report_pdf(self, request, queryset):
     from koalixcrm.crm.views.pdfexport import PDFExportView
     for obj in queryset:
         response = PDFExportView.export_pdf(
             self, request, obj,
             ("/admin/crm/" + obj.__class__.__name__.lower() + "/"), obj.
             project.default_template_set.monthly_project_summary_template)
         return response
Exemplo n.º 5
0
 def create_pdf_of_balance_sheet(self, request, queryset):
     from koalixcrm.crm.views.pdfexport import PDFExportView
     for obj in queryset:
         response = PDFExportView.export_pdf(
             self, request, obj,
             ("/admin/accounting/" + obj.__class__.__name__.lower() + "/"),
             obj.template_set_balance_sheet)
         return response
Exemplo n.º 6
0
 def create_report_pdf(self, request, queryset):
     from koalixcrm.crm.views.pdfexport import PDFExportView
     for obj in queryset:
         response = PDFExportView.export_pdf(self,
                                             request,
                                             obj,
                                             ("/admin/crm/"+obj.__class__.__name__.lower()+"/"),
                                             obj.project.default_template_set.monthly_project_summary_template)
         return response
Exemplo n.º 7
0
 def create_work_report_pdf(self, request, queryset):
     from koalixcrm.crm.views.pdfexport import PDFExportView
     for obj in queryset:
         response = PDFExportView.export_pdf(self,
                                             request,
                                             obj,
                                             ("/admin/djangoUserExtension/"+obj.__class__.__name__.lower()+"/"),
                                             obj.default_template_set.work_report_template)
     return response
Exemplo n.º 8
0
 def create_pdf_of_profit_loss_statement(self, request, queryset):
     from koalixcrm.crm.views.pdfexport import PDFExportView
     for obj in queryset:
         response = PDFExportView.export_pdf(self,
                                             request,
                                             obj,
                                             ("/admin/accounting/"+obj.__class__.__name__.lower()+"/"),
                                             obj.template_profit_loss_statement,)
         return response