Ejemplo n.º 1
0
 def get_object(self):
     orga = organization_manager.get_selected_organization(self.request)
     try:
         settings = self.model.objects.get(organization=orga)
     except self.model.DoesNotExist:
         settings = self.model.objects.create(organization=orga)
     return settings
Ejemplo n.º 2
0
 def get_context_data(self, **kwargs):
     ctx = super().get_context_data(**kwargs)
     orga = organization_manager.get_selected_organization(self.request)
     report = TaxReport(orga, start=self.period.start, end=self.period.end)
     report.generate()
     ctx['tax_summaries'] = report.tax_summaries.values()
     return ctx
Ejemplo n.º 3
0
 def get_context_data(self, **kwargs):
     ctx = super().get_context_data(**kwargs)
     orga = organization_manager.get_selected_organization(self.request)
     report = InvoiceDetailsReport(orga,
                                   start=self.period.start,
                                   end=self.period.end)
     report.generate()
     ctx['invoices'] = report.invoices
     ctx['tax_rates'] = report.tax_rates
     ctx['payrun_settings'] = orga.payrun_settings
     return ctx
Ejemplo n.º 4
0
 def check_completion(self, request):
     orga = organization_manager.get_selected_organization(request)
     if orga is None:
         return False
     try:
         settings = orga.payrun_settings
         settings.full_clean()
     except PayRunSettings.DoesNotExist:
         return False
     except ValidationError:
         return False
     return True
Ejemplo n.º 5
0
    def get_context_data(self, **kwargs):
        ctx = super().get_context_data(**kwargs)
        orga = organization_manager.get_selected_organization(self.request)

        # currrent quarter
        now = timezone.now()
        start = date(year=now.year,
                     month=(now.month - ((now.month - 1) % 3)),
                     day=1)
        end = start + relativedelta(months=3)

        report = ProfitAndLossReport(orga, start=start, end=end)
        report.generate()
        ctx['summaries'] = report.summaries
        ctx['total_summary'] = report.total_summary
        return ctx
Ejemplo n.º 6
0
 def check_completion(self, request):
     orga = organization_manager.get_selected_organization(request)
     if orga is None:
         return False
     count = orga.tax_rates.all().count()
     return count > 0