Merge branch 'Tresorerie' into 'master'

Separate counter for account refounding

See merge request !28
This commit is contained in:
Skia 2016-12-19 16:50:44 +01:00
commit 68517a5d33
4 changed files with 27 additions and 12 deletions

View File

@ -19,7 +19,7 @@ from ajax_select.fields import AutoCompleteSelectField, AutoCompleteSelectMultip
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin
from core.views.forms import SelectFile, SelectDate from core.views.forms import SelectFile, SelectDate
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType, Label from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType, Label
from counter.models import Counter, Selling from counter.models import Counter, Selling, Product
# Main accounting view # Main accounting view
@ -367,11 +367,11 @@ class OperationPDFView(CanViewMixin, DetailView):
im = ImageReader("core/static/core/img/logo.jpg") im = ImageReader("core/static/core/img/logo.jpg")
iw, ih = im.getSize() iw, ih = im.getSize()
p.drawImage(im, 40, height - 50, width=iw/2, height=ih/2) p.drawImage(im, 40, height - 50, width=iw/2, height=ih/2)
labelStr = [["%s %s - %s %s" % (_("Journal"), ti, _("Operation"), num)]] labelStr = [["%s %s - %s %s" % (_("Journal"), ti, _("Operation"), num)]]
label = Table(labelStr, colWidths=[150], rowHeights=[20]) label = Table(labelStr, colWidths=[150], rowHeights=[20])
label.setStyle(TableStyle([ label.setStyle(TableStyle([
('ALIGN',(0,0),(-1,-1),'CENTER'), ('ALIGN',(0,0),(-1,-1),'CENTER'),
('BOX', (0,0), (-1,-1), 0.25, colors.black), ('BOX', (0,0), (-1,-1), 0.25, colors.black),
@ -385,11 +385,11 @@ class OperationPDFView(CanViewMixin, DetailView):
p.drawString(90, height - 190, _("Date: %(date)s") % {"date": date}) p.drawString(90, height - 190, _("Date: %(date)s") % {"date": date})
data = [] data = []
data += [["%s" % (_("Credit").upper() if nature == 'CREDIT' else _("Debit").upper())]] data += [["%s" % (_("Credit").upper() if nature == 'CREDIT' else _("Debit").upper())]]
data += [[_("Amount: %(amount).2f") % {"amount": amount}]] data += [[_("Amount: %(amount).2f") % {"amount": amount}]]
payment_mode = "" payment_mode = ""
for m in settings.SITH_ACCOUNTING_PAYMENT_METHOD: for m in settings.SITH_ACCOUNTING_PAYMENT_METHOD:
if m[0] == mode: if m[0] == mode:
@ -399,11 +399,11 @@ class OperationPDFView(CanViewMixin, DetailView):
payment_mode += " %s\n" %(m[1]) payment_mode += " %s\n" %(m[1])
data += [[payment_mode]] data += [[payment_mode]]
data += [["%s : %s" % (_("Debtor") if nature == 'CREDIT' else _("Creditor"), target), ""]] data += [["%s : %s" % (_("Debtor") if nature == 'CREDIT' else _("Creditor"), target), ""]]
data += [["%s \n%s" % (_("Comment:"), remark)]] data += [["%s \n%s" % (_("Comment:"), remark)]]
t = Table(data, colWidths=[(width-90*2)/2]*2, rowHeights=[20, 20, 70, 20, 80]) t = Table(data, colWidths=[(width-90*2)/2]*2, rowHeights=[20, 20, 70, 20, 80])
t.setStyle(TableStyle([ t.setStyle(TableStyle([
('ALIGN',(0,0),(-1,-1),'CENTER'), ('ALIGN',(0,0),(-1,-1),'CENTER'),
@ -536,11 +536,11 @@ class RefoundAccountView(FormView):
def create_selling(self): def create_selling(self):
with transaction.atomic(): with transaction.atomic():
uprice = self.customer.customer.amount uprice = self.customer.customer.amount
main_club_counter = Counter.objects.filter(club__unix_name=settings.SITH_MAIN_CLUB['unix_name'], refound_club_counter = Counter.objects.get(id=settings.SITH_COUNTER_REFOUND_ID)
type='OFFICE').first() refound_club = refound_club_counter.club
main_club = main_club_counter.club
s = Selling(label=_('Refound account'), unit_price=uprice, s = Selling(label=_('Refound account'), unit_price=uprice,
quantity=1, seller=self.operator, quantity=1, seller=self.operator,
customer=self.customer.customer, customer=self.customer.customer,
club=main_club, counter=main_club_counter) club=refound_club, counter=refound_club_counter,
product=Product.objects.get(id=settings.SITH_PRODUCT_REFOUND_ID))
s.save() s.save()

View File

@ -253,6 +253,9 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
troll = Club(name="Troll Penché", unix_name="troll", troll = Club(name="Troll Penché", unix_name="troll",
address="Terre Du Milieu", parent=main_club) address="Terre Du Milieu", parent=main_club)
troll.save() troll.save()
refound = Club(name="Carte AE", unix_name="carte_ae",
address="Jamais imprimée", parent=main_club)
refound.save()
# Counters # Counters
Customer(user=skia, account_id="6568j", amount=0).save() Customer(user=skia, account_id="6568j", amount=0).save()
@ -274,6 +277,12 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
mde.products.add(cble) mde.products.add(cble)
mde.save() mde.save()
refound_counter = Counter(name="Carte AE", club=refound, type='OFFICE')
refound_counter.save()
refound_product = Product(name="remboursement", code="REMBOURS", purchase_price="0", selling_price="0",
special_selling_price="0", club=refound)
refound_product.save()
# Accounting test values: # Accounting test values:
BankAccount(name="AE TG", club=main_club).save() BankAccount(name="AE TG", club=main_club).save()
BankAccount(name="Carte AE", club=main_club).save() BankAccount(name="Carte AE", club=main_club).save()
@ -295,4 +304,3 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
target_id=bar_club.id).save() target_id=bar_club.id).save()
woenzco = Company(name="Woenzel & co") woenzco = Company(name="Woenzel & co")
woenzco.save() woenzco.save()

View File

@ -29,6 +29,8 @@
<li><a href="{{ url('counter:product_list') }}">{% trans %}Products management{% endtrans %}</a></li> <li><a href="{{ url('counter:product_list') }}">{% trans %}Products management{% endtrans %}</a></li>
<li><a href="{{ url('counter:producttype_list') }}">{% trans %}Product types management{% endtrans %}</a></li> <li><a href="{{ url('counter:producttype_list') }}">{% trans %}Product types management{% endtrans %}</a></li>
<li><a href="{{ url('counter:cash_summary_list') }}">{% trans %}Cash register summaries{% endtrans %}</a></li> <li><a href="{{ url('counter:cash_summary_list') }}">{% trans %}Cash register summaries{% endtrans %}</a></li>
<li><a href="{{ url('counter:invoices_call') }}">{% trans %}Invoices call{% endtrans %}</a></li>
<li><a href="{{ url('counter:eticket_list') }}">{% trans %}Etickets{% endtrans %}</a></li>
{% endif %} {% endif %}
{% for b in settings.SITH_COUNTER_BARS %} {% for b in settings.SITH_COUNTER_BARS %}
{% if user.is_in_group(b[1]+" admin") %} {% if user.is_in_group(b[1]+" admin") %}

View File

@ -257,6 +257,11 @@ SITH_GROUP_BANNED_COUNTER_ID = 7
SITH_GROUP_BANNED_SUBSCRIPTION_ID = 8 SITH_GROUP_BANNED_SUBSCRIPTION_ID = 8
SITH_GROUP_SAS_ADMIN_ID = 9 SITH_GROUP_SAS_ADMIN_ID = 9
SITH_CLUB_REFOUND_ID = 89
SITH_COUNTER_REFOUND_ID = 38
SITH_PRODUCT_REFOUND_ID = 5
# SAS variables # SAS variables
SITH_SAS_ROOT_DIR_ID = 4 SITH_SAS_ROOT_DIR_ID = 4