diff --git a/accounting/migrations/0010_remove_operation_type.py b/accounting/migrations/0010_remove_operation_type.py new file mode 100644 index 00000000..64883343 --- /dev/null +++ b/accounting/migrations/0010_remove_operation_type.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounting', '0009_auto_20160622_1030'), + ] + + operations = [ + migrations.RemoveField( + model_name='operation', + name='type', + ), + ] diff --git a/accounting/models.py b/accounting/models.py index 87c62dd4..e14a0d44 100644 --- a/accounting/models.py +++ b/accounting/models.py @@ -130,7 +130,7 @@ class GeneralJournal(models.Model): self.amount = 0 self.effective_amount = 0 for o in self.operations.all(): - if o.type == "credit": + if o.accounting_type.movement_type == "credit": if o.done: self.effective_amount += o.amount self.amount += o.amount @@ -154,10 +154,6 @@ class Operation(models.Model): invoice = models.FileField(upload_to='invoices', null=True, blank=True) done = models.BooleanField(_('is done'), default=False) accounting_type = models.ForeignKey('AccountingType', related_name="operations") - type = models.CharField(_('operation type'), max_length=8, choices=[ - ('debit', _('Debit')), - ('credit', _('Credit')), - ]) def save(self): super(Operation, self).save() @@ -186,8 +182,8 @@ class Operation(models.Model): return reverse('accounting:journal_details', kwargs={'j_id': self.journal.id}) def __str__(self): - return "%d | %s | %d € | %s | %s | %s" % ( - self.id, self.type, self.amount, self.date, self.accounting_type, self.done, + return "%d | %d € | %s | %s | %s" % ( + self.id, self.amount, self.date, self.accounting_type, self.done, ) class AccountingType(models.Model): diff --git a/accounting/templates/accounting/bank_account_details.jinja b/accounting/templates/accounting/bank_account_details.jinja index 74695755..93d20581 100644 --- a/accounting/templates/accounting/bank_account_details.jinja +++ b/accounting/templates/accounting/bank_account_details.jinja @@ -11,7 +11,7 @@
  • {{ k }} - {{ v }}
  • {% endfor %} -

    New club account

    +

    New club account

    -

    New journal

    +

    New journal