lingo: include a nice label but no ugly URL for paid invoices (#14323)
This commit is contained in:
parent
48595b466e
commit
14f620a8c3
|
@ -0,0 +1,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lingo', '0025_auto_20161206_1713'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='regie',
|
||||
options={'ordering': ('-is_default', 'label'), 'verbose_name': 'Regie'},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='basketitem',
|
||||
name='source_url',
|
||||
field=models.URLField(verbose_name='Source URL', blank=True),
|
||||
),
|
||||
]
|
|
@ -172,7 +172,7 @@ class BasketItem(models.Model):
|
|||
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True)
|
||||
regie = models.ForeignKey(Regie)
|
||||
subject = models.CharField(verbose_name=_('Subject'), max_length=200)
|
||||
source_url = models.URLField(_('Source URL'))
|
||||
source_url = models.URLField(_('Source URL'), blank=True)
|
||||
details = models.TextField(verbose_name=_('Details'), blank=True)
|
||||
amount = models.DecimalField(verbose_name=_('Amount'),
|
||||
decimal_places=2, max_digits=8)
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
{% if transaction.is_paid %}
|
||||
<ul>
|
||||
{% for item in transaction.items.all %}
|
||||
<li>{{ item.subject }}: {{ item.amount }} €</label> (<a href="{{ item.source_url}}">voir</a>)</li>
|
||||
<li>{{ item.subject }}: {{ item.amount }} €</label>
|
||||
{% if item.source_url %}(<a href="{{ item.source_url}}">voir</a>){% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
|
|
|
@ -433,8 +433,8 @@ class CallbackView(View):
|
|||
regie.pay_invoice(item_id, transaction.order_id, transaction.end_date)
|
||||
local_item = BasketItem.objects.create(user=transaction.user,
|
||||
regie=regie,
|
||||
subject=remote_item.display_id,
|
||||
source_url=regie.webservice_url + '/invoice/%s/' % item_id,
|
||||
source_url='',
|
||||
subject=_('Invoice #%s') % remote_item.display_id,
|
||||
amount=remote_item.amount,
|
||||
payment_date=transaction.end_date)
|
||||
transaction.items.add(local_item)
|
||||
|
|
|
@ -156,7 +156,7 @@ def test_anonymous_successful_item_payment(mock_get, mock_pay_invoice, app, remo
|
|||
assert b_item
|
||||
trans = trans[0]
|
||||
b_item = b_item[0]
|
||||
assert b_item.subject == INVOICES[0]['display_id']
|
||||
assert b_item.subject == 'Invoice #%s' % INVOICES[0]['display_id']
|
||||
assert b_item.amount == Decimal(INVOICES[0]['amount'])
|
||||
assert b_item in trans.items.all()
|
||||
|
||||
|
|
Loading…
Reference in New Issue