mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Banktransfer: Save imported date into CharField, date format autodetection never works
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2016-09-08 20:20
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('banktransfer', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='bankimportjob',
|
||||
name='state',
|
||||
field=models.CharField(choices=[('pending', 'pending'), ('running', 'running'), ('error', 'error'), ('completed', 'completed')], default='pending', max_length=32),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='banktransaction',
|
||||
name='date',
|
||||
field=models.CharField(max_length=50),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='banktransaction',
|
||||
name='import_job',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='banktransfer.BankImportJob'),
|
||||
),
|
||||
]
|
||||
@@ -48,7 +48,7 @@ class BankTransaction(models.Model):
|
||||
payer = models.TextField(blank=True)
|
||||
reference = models.TextField(blank=True)
|
||||
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
date = models.DateField()
|
||||
date = models.CharField(max_length=50)
|
||||
order = models.ForeignKey('pretixbase.Order', null=True, blank=True)
|
||||
|
||||
def calculate_checksum(self):
|
||||
@@ -57,7 +57,7 @@ class BankTransaction(models.Model):
|
||||
hasher.update(clean.sub('', self.payer.lower()).encode('utf-8'))
|
||||
hasher.update(clean.sub('', self.reference.lower()).encode('utf-8'))
|
||||
hasher.update(clean.sub('', str(self.amount).lower()).encode('utf-8'))
|
||||
hasher.update(clean.sub('', str(self.date).lower()).encode('utf-8'))
|
||||
hasher.update(clean.sub('', self.date.lower()).encode('utf-8'))
|
||||
return str(hasher.hexdigest())
|
||||
|
||||
def shred_private_data(self):
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
table.transaction-list td.actions {
|
||||
max-width: 100px;
|
||||
}
|
||||
table.transaction-list td.actions .input-group {
|
||||
display: inline-block;
|
||||
width: 110px;
|
||||
}
|
||||
table.transaction-list td.actions .input-group button {
|
||||
line-height: 1.43;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import logging
|
||||
import re
|
||||
from decimal import Decimal
|
||||
|
||||
import dateutil.parser
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.utils.translation import ugettext_noop
|
||||
@@ -73,12 +72,11 @@ def _get_unknown_transactions(event: Event, job: BankImportJob, data: list):
|
||||
logger.exception('Could not parse amount of transaction: {}'.format(amount))
|
||||
amount = Decimal("0.00")
|
||||
|
||||
date = dateutil.parser.parse(row['date'])
|
||||
trans = BankTransaction(event=event, import_job=job,
|
||||
payer=row['payer'],
|
||||
reference=row['reference'],
|
||||
amount=amount,
|
||||
date=date)
|
||||
date=row['date'])
|
||||
trans.checksum = trans.calculate_checksum()
|
||||
if trans.checksum not in known_checksums:
|
||||
trans.state = BankTransaction.STATE_UNCHECKED
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ trans.date|date:"SHORT_DATE_FORMAT" }}</td>
|
||||
<td>{{ trans.date }}</td>
|
||||
<td>{{ trans.payer }}<br/>{{ trans.reference }}</td>
|
||||
<td>{{ trans.amount|floatformat:2 }}</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user