mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Add new field OrderRefund.comment
This commit is contained in:
@@ -22,7 +22,7 @@ def get_refund_export_csv(refund_export: RefundExport):
|
||||
output = StreamWriter(byte_data)
|
||||
|
||||
writer = csv.writer(output)
|
||||
writer.writerow([_("Payer"), "IBAN", "BIC", _("Amount"), _("Currency"), _("Code")])
|
||||
writer.writerow([_("Payer"), "IBAN", "BIC", _("Amount"), _("Currency"), _("Code"), _("Comment")])
|
||||
for row in refund_export.rows_data:
|
||||
bic = ''
|
||||
if row.get('bic'):
|
||||
@@ -39,6 +39,7 @@ def get_refund_export_csv(refund_export: RefundExport):
|
||||
localize(Decimal(row['amount'])),
|
||||
refund_export.currency,
|
||||
row['id'],
|
||||
row.get('comment') or '',
|
||||
])
|
||||
|
||||
filename = _get_filename(refund_export) + ".csv"
|
||||
@@ -68,7 +69,7 @@ def build_sepa_xml(refund_export: RefundExport, account_holder, iban, bic):
|
||||
"IBAN": row["iban"],
|
||||
"amount": int(Decimal(row['amount']) * 100), # in euro-cents
|
||||
"execution_date": datetime.date.today(),
|
||||
"description": f"{_('Refund')} {refund_export.entity_slug} {row['id']}",
|
||||
"description": f"{_('Refund')} {refund_export.entity_slug} {row['id']} {row.get('comment') or ''}".strip()[:140],
|
||||
}
|
||||
if row.get('bic'):
|
||||
try:
|
||||
|
||||
@@ -20,6 +20,7 @@ from pretix.base.services.mail import SendMailException
|
||||
from pretix.base.services.orders import change_payment_provider
|
||||
from pretix.base.services.tasks import TransactionAwareTask
|
||||
from pretix.celery_app import app
|
||||
|
||||
from .models import BankImportJob, BankTransaction
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -602,6 +602,7 @@ def _unite_transaction_rows(transaction_rows):
|
||||
"id": ", ".join(sorted(set(r['id'] for r in rows))),
|
||||
"payer": ", ".join(sorted(set(r['payer'] for r in rows))),
|
||||
"amount": sum(r['amount'] for r in rows),
|
||||
"comment": ", ".join(r['comment'] for r in rows if r.get('comment')) or None,
|
||||
})
|
||||
return united_transactions_rows
|
||||
|
||||
@@ -649,6 +650,7 @@ class RefundExportListView(ListView):
|
||||
transaction_rows.append({
|
||||
"amount": refund.amount,
|
||||
"id": refund.full_id,
|
||||
"comment": refund.comment,
|
||||
**{key: data.get(key) for key in ("payer", "iban", "bic")}
|
||||
})
|
||||
refund.done(user=self.request.user)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import copy
|
||||
import tempfile
|
||||
from collections import OrderedDict, defaultdict
|
||||
from datetime import date, datetime, timedelta, time
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
import pytz
|
||||
|
||||
Reference in New Issue
Block a user