def post(self, request, *args, **kwargs): if 'adjust' in self.request.POST: if self.adjust_balance_form.is_valid(): self.adjust_balance_form.adjust_balance( web_user=self.request.user.username, ) return HttpResponseRedirect(request.META.get('HTTP_REFERER') or self.page_url) elif 'resend' in self.request.POST: if self.resend_email_form.is_valid(): try: self.resend_email_form.resend_email() return HttpResponseRedirect(self.page_url) except Exception as e: messages.error(request, "Could not send emails due to: %s" % e) elif SuppressInvoiceForm.submit_kwarg in self.request.POST: if self.suppress_invoice_form.is_valid(): self.suppress_invoice_form.suppress_invoice() if self.invoice.is_customer_invoice: return HttpResponseRedirect(CustomerInvoiceInterface.get_url()) else: return HttpResponseRedirect(InvoiceInterface.get_url()) elif HideInvoiceForm.submit_kwarg in self.request.POST: if self.hide_invoice_form.is_valid(): self.hide_invoice_form.hide_invoice() return self.get(request, *args, **kwargs)
def post(self, request, *args, **kwargs): if 'adjust' in self.request.POST: if self.adjust_balance_form.is_valid(): self.adjust_balance_form.adjust_balance( web_user=self.request.user.username, ) return HttpResponseRedirect(request.META.get('HTTP_REFERER') or self.page_url) elif 'resend' in self.request.POST: if self.resend_email_form.is_valid(): try: self.resend_email_form.resend_email() return HttpResponseRedirect(self.page_url) except Exception as e: messages.error(request, "Could not send emails due to: %s" % e) elif SuppressInvoiceForm.submit_kwarg in self.request.POST: if self.suppress_invoice_form.is_valid(): self.suppress_invoice_form.suppress_invoice() if self.invoice.is_customer_invoice: return HttpResponseRedirect(CustomerInvoiceInterface.get_url()) else: return HttpResponseRedirect(InvoiceInterface.get_url()) elif HideInvoiceForm.submit_kwarg in self.request.POST: if self.hide_invoice_form.is_valid(): self.hide_invoice_form.hide_invoice() return self.get(request, *args, **kwargs)
def invoice_context(self): subscriber_domain = self.subscription.subscriber.domain if self.subscription.account.is_customer_billing_account: invoice_report = CustomerInvoiceInterface(self.request) invoice_report.filter_by_account(self.subscription.account) else: invoice_report = InvoiceInterface(self.request) invoice_report.filter_by_subscription(self.subscription) # Tied to InvoiceInterface. encoded_params = urlencode({'subscriber': subscriber_domain}) invoice_report_url = "{}?{}".format(invoice_report.get_url(), encoded_params) invoice_export_url = "{}?{}".format(invoice_report.get_url(render_as='export'), encoded_params) return { 'invoice_headers': invoice_report.headers, 'invoice_rows': invoice_report.rows, 'invoice_export_url': invoice_export_url, 'invoice_report_url': invoice_report_url, 'adjust_balance_forms': invoice_report.adjust_balance_forms, }
def invoice_context(self): subscriber_domain = self.subscription.subscriber.domain if self.subscription.account.is_customer_billing_account: invoice_report = CustomerInvoiceInterface(self.request) invoice_report.filter_by_account(self.subscription.account) else: invoice_report = InvoiceInterface(self.request) invoice_report.filter_by_subscription(self.subscription) # Tied to InvoiceInterface. encoded_params = urlencode({'subscriber': subscriber_domain}) invoice_report_url = "{}?{}".format(invoice_report.get_url(), encoded_params) invoice_export_url = "{}?{}".format(invoice_report.get_url(render_as='export'), encoded_params) return { 'invoice_headers': invoice_report.headers, 'invoice_rows': invoice_report.rows, 'invoice_export_url': invoice_export_url, 'invoice_report_url': invoice_report_url, 'adjust_balance_forms': invoice_report.adjust_balance_forms, }
def parent_pages(self): return [{ 'title': CustomerInvoiceInterface.name, 'url': CustomerInvoiceInterface.get_url() }]
def parent_pages(self): return [{ 'title': CustomerInvoiceInterface.name, 'url': CustomerInvoiceInterface.get_url() }]