|  |  |  | @@ -22,25 +22,21 @@ | 
		
	
		
			
				|  |  |  |  | # | 
		
	
		
			
				|  |  |  |  | # | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | from django.views.generic import ListView, DetailView, RedirectView | 
		
	
		
			
				|  |  |  |  | from django.views.generic import ListView, DetailView | 
		
	
		
			
				|  |  |  |  | from django.views.generic.edit import UpdateView, CreateView, DeleteView, FormView | 
		
	
		
			
				|  |  |  |  | from django.shortcuts import render | 
		
	
		
			
				|  |  |  |  | from django.core.urlresolvers import reverse_lazy, reverse | 
		
	
		
			
				|  |  |  |  | from django.utils.translation import ugettext_lazy as _ | 
		
	
		
			
				|  |  |  |  | from django.forms.models import modelform_factory | 
		
	
		
			
				|  |  |  |  | from django.core.exceptions import PermissionDenied, ValidationError | 
		
	
		
			
				|  |  |  |  | from django.forms import HiddenInput, TextInput | 
		
	
		
			
				|  |  |  |  | from django.forms import HiddenInput | 
		
	
		
			
				|  |  |  |  | from django.db import transaction | 
		
	
		
			
				|  |  |  |  | from django.db.models import Sum | 
		
	
		
			
				|  |  |  |  | from django.conf import settings | 
		
	
		
			
				|  |  |  |  | from django import forms | 
		
	
		
			
				|  |  |  |  | from django.http import HttpResponseRedirect, HttpResponse | 
		
	
		
			
				|  |  |  |  | from django.utils.translation import ugettext as _ | 
		
	
		
			
				|  |  |  |  | from django.conf import settings | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | from django.http import HttpResponse | 
		
	
		
			
				|  |  |  |  | import collections | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | from ajax_select.fields import AutoCompleteSelectField, AutoCompleteSelectMultipleField | 
		
	
		
			
				|  |  |  |  | from ajax_select.fields import AutoCompleteSelectField | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin, TabedViewMixin | 
		
	
		
			
				|  |  |  |  | from core.views.forms import SelectFile, SelectDate | 
		
	
	
		
			
				
					
					|  |  |  | @@ -49,6 +45,7 @@ from counter.models import Counter, Selling, Product | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Main accounting view | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class BankAccountListView(CanViewMixin, ListView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     A list view for the admins | 
		
	
	
		
			
				
					
					|  |  |  | @@ -57,6 +54,7 @@ class BankAccountListView(CanViewMixin, ListView): | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/bank_account_list.jinja' | 
		
	
		
			
				|  |  |  |  |     ordering = ['name'] | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Simplified accounting types | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class SimplifiedAccountingTypeListView(CanViewMixin, ListView): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -66,6 +64,7 @@ class SimplifiedAccountingTypeListView(CanViewMixin, ListView): | 
		
	
		
			
				|  |  |  |  |     model = SimplifiedAccountingType | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/simplifiedaccountingtype_list.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class SimplifiedAccountingTypeEditView(CanViewMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     An edit view for the admins | 
		
	
	
		
			
				
					
					|  |  |  | @@ -75,6 +74,7 @@ class SimplifiedAccountingTypeEditView(CanViewMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['label', 'accounting_type'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class SimplifiedAccountingTypeCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create an accounting type (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -83,6 +83,7 @@ class SimplifiedAccountingTypeCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['label', 'accounting_type'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/create.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Accounting types | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class AccountingTypeListView(CanViewMixin, ListView): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -92,6 +93,7 @@ class AccountingTypeListView(CanViewMixin, ListView): | 
		
	
		
			
				|  |  |  |  |     model = AccountingType | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/accountingtype_list.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class AccountingTypeEditView(CanViewMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     An edit view for the admins | 
		
	
	
		
			
				
					
					|  |  |  | @@ -101,6 +103,7 @@ class AccountingTypeEditView(CanViewMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['code', 'label', 'movement_type'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class AccountingTypeCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create an accounting type (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -109,6 +112,7 @@ class AccountingTypeCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['code', 'label', 'movement_type'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/create.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # BankAccount views | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class BankAccountEditView(CanViewMixin, UpdateView): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -120,6 +124,7 @@ class BankAccountEditView(CanViewMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['name', 'iban', 'number', 'club'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class BankAccountDetailView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     A detail view, listing every club account | 
		
	
	
		
			
				
					
					|  |  |  | @@ -128,6 +133,7 @@ class BankAccountDetailView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     pk_url_kwarg = "b_account_id" | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/bank_account_details.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class BankAccountCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create a bank account (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -136,6 +142,7 @@ class BankAccountCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['name', 'club', 'iban', 'number'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/create.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class BankAccountDeleteView(CanEditPropMixin, DeleteView):  # TODO change Delete to Close | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Delete a bank account (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -145,6 +152,7 @@ class BankAccountDeleteView(CanEditPropMixin, DeleteView): # TODO change Delete | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/delete_confirm.jinja' | 
		
	
		
			
				|  |  |  |  |     success_url = reverse_lazy('accounting:bank_list') | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # ClubAccount views | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class ClubAccountEditView(CanViewMixin, UpdateView): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -156,6 +164,7 @@ class ClubAccountEditView(CanViewMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['name', 'club', 'bank_account'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class ClubAccountDetailView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     A detail view, listing every journal | 
		
	
	
		
			
				
					
					|  |  |  | @@ -164,6 +173,7 @@ class ClubAccountDetailView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     pk_url_kwarg = "c_account_id" | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/club_account_details.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class ClubAccountCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create a club account (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -180,6 +190,7 @@ class ClubAccountCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |                 ret['bank_account'] = obj.id | 
		
	
		
			
				|  |  |  |  |         return ret | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class ClubAccountDeleteView(CanEditPropMixin, DeleteView):  # TODO change Delete to Close | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Delete a club account (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -189,6 +200,7 @@ class ClubAccountDeleteView(CanEditPropMixin, DeleteView): # TODO change Delete | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/delete_confirm.jinja' | 
		
	
		
			
				|  |  |  |  |     success_url = reverse_lazy('accounting:bank_list') | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Journal views | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalTabsMixin(TabedViewMixin): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -219,6 +231,7 @@ class JournalTabsMixin(TabedViewMixin): | 
		
	
		
			
				|  |  |  |  |         }) | 
		
	
		
			
				|  |  |  |  |         return tab_list | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create a general journal | 
		
	
	
		
			
				
					
					|  |  |  | @@ -236,6 +249,7 @@ class JournalCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |                 ret['club_account'] = obj.id | 
		
	
		
			
				|  |  |  |  |         return ret | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalDetailView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     A detail view, listing every operation | 
		
	
	
		
			
				
					
					|  |  |  | @@ -245,6 +259,7 @@ class JournalDetailView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/journal_details.jinja' | 
		
	
		
			
				|  |  |  |  |     current_tab = 'journal' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalEditView(CanEditMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Update a general journal | 
		
	
	
		
			
				
					
					|  |  |  | @@ -254,6 +269,7 @@ class JournalEditView(CanEditMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     fields = ['name', 'start_date', 'end_date', 'club_account', 'closed'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalDeleteView(CanEditPropMixin, DeleteView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Delete a club account (for the admins) | 
		
	
	
		
			
				
					
					|  |  |  | @@ -270,6 +286,7 @@ class JournalDeleteView(CanEditPropMixin, DeleteView): | 
		
	
		
			
				|  |  |  |  |         else: | 
		
	
		
			
				|  |  |  |  |             raise PermissionDenied | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Operation views | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class OperationForm(forms.ModelForm): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -350,6 +367,7 @@ class OperationForm(forms.ModelForm): | 
		
	
		
			
				|  |  |  |  |             self.save() | 
		
	
		
			
				|  |  |  |  |         return ret | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class OperationCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create an operation | 
		
	
	
		
			
				
					
					|  |  |  | @@ -376,6 +394,7 @@ class OperationCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |             kwargs['object'] = self.journal | 
		
	
		
			
				|  |  |  |  |         return kwargs | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class OperationEditView(CanEditMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     An edit view, working as detail for the moment | 
		
	
	
		
			
				
					
					|  |  |  | @@ -391,6 +410,7 @@ class OperationEditView(CanEditMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |         kwargs['object'] = self.object.journal | 
		
	
		
			
				|  |  |  |  |         return kwargs | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class OperationPDFView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Display the PDF of a given operation | 
		
	
	
		
			
				
					
					|  |  |  | @@ -402,11 +422,10 @@ class OperationPDFView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     def get(self, request, *args, **kwargs): | 
		
	
		
			
				|  |  |  |  |         from reportlab.pdfgen import canvas | 
		
	
		
			
				|  |  |  |  |         from reportlab.lib.units import cm | 
		
	
		
			
				|  |  |  |  |         from reportlab.platypus import SimpleDocTemplate, Table, TableStyle | 
		
	
		
			
				|  |  |  |  |         from reportlab.platypus import Table, TableStyle | 
		
	
		
			
				|  |  |  |  |         from reportlab.lib import colors | 
		
	
		
			
				|  |  |  |  |         from reportlab.lib.pagesizes import letter | 
		
	
		
			
				|  |  |  |  |         from reportlab.lib.utils import ImageReader | 
		
	
		
			
				|  |  |  |  |         from reportlab.graphics.shapes import Drawing | 
		
	
		
			
				|  |  |  |  |         from reportlab.pdfbase.ttfonts import TTFont | 
		
	
		
			
				|  |  |  |  |         from reportlab.pdfbase import pdfmetrics | 
		
	
		
			
				|  |  |  |  |  | 
		
	
	
		
			
				
					
					|  |  |  | @@ -419,7 +438,6 @@ class OperationPDFView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |         num = self.object.number | 
		
	
		
			
				|  |  |  |  |         date = self.object.date | 
		
	
		
			
				|  |  |  |  |         mode = self.object.mode | 
		
	
		
			
				|  |  |  |  |         cheque_number = self.object.cheque_number | 
		
	
		
			
				|  |  |  |  |         club_name = self.object.journal.club_account.name | 
		
	
		
			
				|  |  |  |  |         ti = self.object.journal.name | 
		
	
		
			
				|  |  |  |  |         op_label = self.object.label | 
		
	
	
		
			
				
					
					|  |  |  | @@ -455,7 +473,7 @@ class OperationPDFView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |         p.drawString(90, height - 100, _("Financial proof: ") + "OP%010d" % (id_op))  # Justificatif du libellé | 
		
	
		
			
				|  |  |  |  |         p.drawString(90, height - 130, _("Club: %(club_name)s") % ({"club_name": club_name})) | 
		
	
		
			
				|  |  |  |  |         p.drawString(90, height - 160, _("Label: %(op_label)s") % {"op_label": op_label if op_label != None else ""}) | 
		
	
		
			
				|  |  |  |  |         p.drawString(90, height - 160, _("Label: %(op_label)s") % {"op_label": op_label if op_label is not None else ""}) | 
		
	
		
			
				|  |  |  |  |         p.drawString(90, height - 190, _("Date: %(date)s") % {"date": date}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |         data = [] | 
		
	
	
		
			
				
					
					|  |  |  | @@ -516,6 +534,7 @@ class OperationPDFView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |         p.save() | 
		
	
		
			
				|  |  |  |  |         return response | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalNatureStatementView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Display a statement sorted by labels | 
		
	
	
		
			
				
					
					|  |  |  | @@ -532,8 +551,10 @@ class JournalNatureStatementView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |         for sat in [None] + list(SimplifiedAccountingType.objects.order_by('label').all()): | 
		
	
		
			
				|  |  |  |  |             sum = queryset.filter(accounting_type__movement_type=movement_type, | 
		
	
		
			
				|  |  |  |  |                                   simpleaccounting_type=sat).aggregate(amount_sum=Sum('amount'))['amount_sum'] | 
		
	
		
			
				|  |  |  |  |             if sat: sat = sat.label | 
		
	
		
			
				|  |  |  |  |             else: sat = "" | 
		
	
		
			
				|  |  |  |  |             if sat: | 
		
	
		
			
				|  |  |  |  |                 sat = sat.label | 
		
	
		
			
				|  |  |  |  |             else: | 
		
	
		
			
				|  |  |  |  |                 sat = "" | 
		
	
		
			
				|  |  |  |  |             if sum: | 
		
	
		
			
				|  |  |  |  |                 total_sum += sum | 
		
	
		
			
				|  |  |  |  |                 statement[sat] = sum | 
		
	
	
		
			
				
					
					|  |  |  | @@ -566,6 +587,7 @@ class JournalNatureStatementView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |         kwargs['statement'] = self.big_statement() | 
		
	
		
			
				|  |  |  |  |         return kwargs | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalPersonStatementView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Calculate a dictionary with operation target and sum of operations | 
		
	
	
		
			
				
					
					|  |  |  | @@ -598,6 +620,7 @@ class JournalPersonStatementView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |         kwargs['total_debit'] = self.total("DEBIT") | 
		
	
		
			
				|  |  |  |  |         return kwargs | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class JournalAccountingStatementView(JournalTabsMixin, CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Calculate a dictionary with operation type and sum of operations | 
		
	
	
		
			
				
					
					|  |  |  | @@ -624,10 +647,12 @@ class JournalAccountingStatementView(JournalTabsMixin, CanViewMixin, DetailView) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Company views | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class CompanyListView(CanViewMixin, ListView): | 
		
	
		
			
				|  |  |  |  |     model = Company | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/co_list.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class CompanyCreateView(CanCreateMixin, CreateView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create a company | 
		
	
	
		
			
				
					
					|  |  |  | @@ -648,6 +673,7 @@ class CompanyEditView(CanCreateMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |     success_url = reverse_lazy('accounting:co_list') | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | # Label views | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class LabelListView(CanViewMixin, DetailView): | 
		
	
	
		
			
				
					
					|  |  |  | @@ -655,6 +681,7 @@ class LabelListView(CanViewMixin, DetailView): | 
		
	
		
			
				|  |  |  |  |     pk_url_kwarg = "clubaccount_id" | 
		
	
		
			
				|  |  |  |  |     template_name = 'accounting/label_list.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class LabelCreateView(CanCreateMixin, CreateView):  # FIXME we need to check the rights before creating the object | 
		
	
		
			
				|  |  |  |  |     model = Label | 
		
	
		
			
				|  |  |  |  |     form_class = modelform_factory(Label, fields=['name', 'club_account'], widgets={ | 
		
	
	
		
			
				
					
					|  |  |  | @@ -670,12 +697,14 @@ class LabelCreateView(CanCreateMixin, CreateView): # FIXME we need to check the | 
		
	
		
			
				|  |  |  |  |                 ret['club_account'] = obj.id | 
		
	
		
			
				|  |  |  |  |         return ret | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class LabelEditView(CanEditMixin, UpdateView): | 
		
	
		
			
				|  |  |  |  |     model = Label | 
		
	
		
			
				|  |  |  |  |     pk_url_kwarg = "label_id" | 
		
	
		
			
				|  |  |  |  |     fields = ['name'] | 
		
	
		
			
				|  |  |  |  |     template_name = 'core/edit.jinja' | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class LabelDeleteView(CanEditMixin, DeleteView): | 
		
	
		
			
				|  |  |  |  |     model = Label | 
		
	
		
			
				|  |  |  |  |     pk_url_kwarg = "label_id" | 
		
	
	
		
			
				
					
					|  |  |  | @@ -684,9 +713,11 @@ class LabelDeleteView(CanEditMixin, DeleteView): | 
		
	
		
			
				|  |  |  |  |     def get_success_url(self): | 
		
	
		
			
				|  |  |  |  |         return self.object.get_absolute_url() | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class CloseCustomerAccountForm(forms.Form): | 
		
	
		
			
				|  |  |  |  |     user = AutoCompleteSelectField('users', label=_('Refound this account'), help_text=None, required=True) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | class RefoundAccountView(FormView): | 
		
	
		
			
				|  |  |  |  |     """ | 
		
	
		
			
				|  |  |  |  |     Create a selling with the same amount than the current user money | 
		
	
	
		
			
				
					
					|  |  |  |   |