invoicing: add event_date in line models (#73514)
gitea-wip/lingo/pipeline/pr-main This commit looks good
Details
gitea-wip/lingo/pipeline/pr-main This commit looks good
Details
This commit is contained in:
parent
49ebe18ee5
commit
cfa59aa4d1
|
@ -0,0 +1,25 @@
|
|||
import datetime
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('invoicing', '0009_user_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='draftinvoiceline',
|
||||
name='event_date',
|
||||
field=models.DateField(default=datetime.date.today),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='invoiceline',
|
||||
name='event_date',
|
||||
field=models.DateField(default=datetime.date.today),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -206,6 +206,7 @@ class InjectedLine(models.Model):
|
|||
|
||||
|
||||
class AbstractInvoiceLine(models.Model):
|
||||
event_date = models.DateField()
|
||||
slug = models.SlugField(max_length=250)
|
||||
label = models.CharField(max_length=260)
|
||||
quantity = models.FloatField()
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<ul class="objects-list" data-invoice-id="{{ line.invoice_id }}">
|
||||
{% endifchanged %}
|
||||
<li>
|
||||
#{{ line.pk }} {{ line.user_name }} - {{ line.label }} ({{ line.total_amount }})
|
||||
#{{ line.pk }} {{ line.user_name }} - {{ line.event_date|date:"d/m/Y" }} - {{ line.label }} ({{ line.total_amount }})
|
||||
</li>
|
||||
{% if forloop.last %}</ul>{% endif %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
<tr>
|
||||
<th>{% trans "PK" %}</th>
|
||||
<th>{% trans "Invoice PK" %}</th>
|
||||
<th>{% trans "Label" %}</th>
|
||||
<th>{% trans "Slug" %}</th>
|
||||
<th>{% trans "Event" %}</th>
|
||||
<th>{% trans "Quantity" %}</th>
|
||||
<th>{% trans "Unit amount" %}</th>
|
||||
<th>{% trans "Total amount" %}</th>
|
||||
|
@ -48,8 +47,11 @@
|
|||
<tr data-line-id="{{ line.pk }}">
|
||||
<td class="line_id">{{ line.pk }}</td>
|
||||
<td>{{ line.invoice_id|default:'' }}</td>
|
||||
<td>{{ line.label }}</td>
|
||||
<td>{{ line.slug }}</td>
|
||||
<td>
|
||||
{{ line.event_date|date:"d/m/Y" }} - {{ line.label }}
|
||||
<br />
|
||||
({{ line.slug }})
|
||||
</td>
|
||||
<td>{{ line.quantity }}</td>
|
||||
<td>{{ line.unit_amount }}</td>
|
||||
<td>{{ line.total_amount }}</td>
|
||||
|
@ -64,7 +66,10 @@
|
|||
</tr>
|
||||
<tr data-details-for-line-id="{{ line.pk }}" style="display: none">
|
||||
<td colspan="10">
|
||||
{% trans "Pricing data:" %}
|
||||
<pre>{{ line.pricing_data|pprint }}</pre>
|
||||
{% trans "Event:" %}
|
||||
<pre>{{ line.event|pprint }}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -108,6 +108,7 @@ def get_invoice_lines_for_user(agendas, agendas_pricings, user_external_id, user
|
|||
}
|
||||
lines.append(
|
||||
DraftInvoiceLine(
|
||||
event_date=event_date,
|
||||
slug=event_slug,
|
||||
label=serialized_event['label'],
|
||||
quantity=0,
|
||||
|
@ -126,6 +127,7 @@ def get_invoice_lines_for_user(agendas, agendas_pricings, user_external_id, user
|
|||
# XXX log all context !
|
||||
lines.append(
|
||||
DraftInvoiceLine(
|
||||
event_date=event_date,
|
||||
slug=event_slug,
|
||||
label=serialized_event['label'],
|
||||
quantity=1,
|
||||
|
@ -163,6 +165,7 @@ def get_invoice_lines_for_user(agendas, agendas_pricings, user_external_id, user
|
|||
for injected_line in injected_lines:
|
||||
lines.append(
|
||||
DraftInvoiceLine(
|
||||
event_date=injected_line.event_date,
|
||||
slug=injected_line.slug,
|
||||
label=injected_line.label,
|
||||
quantity=injected_line.quantity,
|
||||
|
|
|
@ -120,6 +120,7 @@ def test_detail_campaign(app, admin_user):
|
|||
assert '/manage/invoicing/campaign/%s/pool/add/' % (campaign.pk) not in resp
|
||||
|
||||
line = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
total_amount=1,
|
||||
|
@ -149,6 +150,7 @@ def test_detail_campaign(app, admin_user):
|
|||
assert 'tag-error' not in resp
|
||||
|
||||
line = InvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
total_amount=1,
|
||||
|
@ -264,6 +266,7 @@ def test_delete_campaign(app, admin_user):
|
|||
regie = Regie.objects.create(label='Foo')
|
||||
invoice = DraftInvoice.objects.create(date_issue=datetime.date.today(), regie=regie, pool=pool)
|
||||
DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
invoice=invoice,
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
@ -386,6 +389,7 @@ def test_detail_pool(app, admin_user):
|
|||
assert '/manage/invoicing/campaign/%s/pool/%s/delete/' % (campaign.pk, pool.pk) in resp
|
||||
|
||||
line = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
total_amount=1,
|
||||
|
@ -417,6 +421,7 @@ def test_detail_pool(app, admin_user):
|
|||
pool.draft = False
|
||||
pool.save()
|
||||
line = InvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
total_amount=1,
|
||||
|
@ -461,6 +466,7 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
)
|
||||
|
||||
line11 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
invoice=invoice1,
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
@ -472,6 +478,7 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
user_name='User1 Name1',
|
||||
)
|
||||
line12 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 2),
|
||||
invoice=invoice1,
|
||||
quantity=1,
|
||||
unit_amount=2,
|
||||
|
@ -483,6 +490,7 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
user_name='User2 Name2',
|
||||
)
|
||||
line13 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 3),
|
||||
invoice=invoice1,
|
||||
quantity=1,
|
||||
unit_amount=3,
|
||||
|
@ -495,6 +503,7 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
)
|
||||
|
||||
orphan_line = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=42,
|
||||
total_amount=42,
|
||||
|
@ -506,6 +515,7 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
)
|
||||
|
||||
line21 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
invoice=invoice2,
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
@ -527,15 +537,15 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
assert len(resp.pyquery('ul[data-invoice-id="%s"] li' % invoice1.pk)) == 3
|
||||
assert (
|
||||
resp.pyquery('ul[data-invoice-id="%s"] li:nth-child(1)' % invoice1.pk).text()
|
||||
== '#%s User1 Name1 - Label 11 (1.00)' % line11.pk
|
||||
== '#%s User1 Name1 - 01/09/2022 - Label 11 (1.00)' % line11.pk
|
||||
)
|
||||
assert (
|
||||
resp.pyquery('ul[data-invoice-id="%s"] li:nth-child(2)' % invoice1.pk).text()
|
||||
== '#%s User1 Name1 - Label 13 (3.00)' % line13.pk
|
||||
== '#%s User1 Name1 - 03/09/2022 - Label 13 (3.00)' % line13.pk
|
||||
)
|
||||
assert (
|
||||
resp.pyquery('ul[data-invoice-id="%s"] li:nth-child(3)' % invoice1.pk).text()
|
||||
== '#%s User2 Name2 - Label 12 (2.00)' % line12.pk
|
||||
== '#%s User2 Name2 - 02/09/2022 - Label 12 (2.00)' % line12.pk
|
||||
)
|
||||
assert (
|
||||
resp.pyquery('h3[data-invoice-id="%s"]' % invoice2.pk).text()
|
||||
|
@ -544,7 +554,7 @@ def test_detail_pool_invoices(app, admin_user):
|
|||
assert len(resp.pyquery('ul[data-invoice-id="%s"] li' % invoice2.pk)) == 1
|
||||
assert (
|
||||
resp.pyquery('ul[data-invoice-id="%s"] li:nth-child(1)' % invoice2.pk).text()
|
||||
== '#%s User1 Name1 - Label 21 (1.00)' % line21.pk
|
||||
== '#%s User1 Name1 - 01/09/2022 - Label 21 (1.00)' % line21.pk
|
||||
)
|
||||
|
||||
|
||||
|
@ -595,6 +605,7 @@ def test_journal_pool(app, admin_user):
|
|||
assert '/manage/invoicing/campaign/%s/pool/%s/delete/' % (campaign.pk, pool.pk) in resp
|
||||
|
||||
line = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
total_amount=1,
|
||||
|
@ -626,6 +637,7 @@ def test_journal_pool(app, admin_user):
|
|||
pool.draft = False
|
||||
pool.save()
|
||||
line = InvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
total_amount=1,
|
||||
|
@ -666,6 +678,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
|
||||
lines = [
|
||||
DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
invoice=invoice,
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
@ -673,6 +686,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
status='success',
|
||||
pool=pool,
|
||||
pricing_data={'foo': 'bar'},
|
||||
event={'event': 'foobar'},
|
||||
)
|
||||
]
|
||||
errors = [
|
||||
|
@ -702,6 +716,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
for error, error_details in errors:
|
||||
lines.append(
|
||||
DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
invoice=invoice,
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
@ -712,6 +727,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
'error': error,
|
||||
'error_details': error_details,
|
||||
},
|
||||
event={'event': 'foobar'},
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -723,7 +739,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
assert format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[0].pk).text()) == 'Success'
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[0].pk).text().strip()
|
||||
== "{'foo': 'bar'}"
|
||||
== "{'foo': 'bar'} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[1].pk).text())
|
||||
|
@ -731,7 +747,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[1].pk).text().strip()
|
||||
== "{'error': 'AgendaPricingNotFound', 'error_details': {}}"
|
||||
== "{'error': 'AgendaPricingNotFound', 'error_details': {}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[2].pk).text())
|
||||
|
@ -739,7 +755,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[2].pk).text().strip()
|
||||
== "{'error': 'CriteriaConditionNotFound', 'error_details': {'category': 'cat-foo'}}"
|
||||
== "{'error': 'CriteriaConditionNotFound', 'error_details': {'category': 'cat-foo'}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[3].pk).text())
|
||||
|
@ -747,7 +763,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[3].pk).text().strip()
|
||||
== "{'error': 'MultipleDefaultCriteriaCondition', 'error_details': {'category': 'cat-foo'}}"
|
||||
== "{'error': 'MultipleDefaultCriteriaCondition', 'error_details': {'category': 'cat-foo'}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[4].pk).text())
|
||||
|
@ -755,7 +771,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[4].pk).text().strip()
|
||||
== "{'error': 'PricingDataError', 'error_details': {'criterias': {'foo': 'bar', 'qf': 'qf-1'}}}"
|
||||
== "{'error': 'PricingDataError', 'error_details': {'criterias': {'foo': 'bar', 'qf': 'qf-1'}}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[5].pk).text())
|
||||
|
@ -763,7 +779,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[5].pk).text().strip()
|
||||
== "{'error': 'PricingDataFormatError', 'error_details': {'pricing': 'foobar', 'wanted': 'decimal'}}"
|
||||
== "{'error': 'PricingDataFormatError', 'error_details': {'pricing': 'foobar', 'wanted': 'decimal'}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[6].pk).text())
|
||||
|
@ -771,7 +787,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[6].pk).text().strip()
|
||||
== "{'error': 'PricingUnknownCheckStatusError', 'error_details': {'status': 'unknown'}}"
|
||||
== "{'error': 'PricingUnknownCheckStatusError', 'error_details': {'status': 'unknown'}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[7].pk).text())
|
||||
|
@ -779,7 +795,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[7].pk).text().strip()
|
||||
== "{'error': 'PricingEventNotCheckedError', 'error_details': {}}"
|
||||
== "{'error': 'PricingEventNotCheckedError', 'error_details': {}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[8].pk).text())
|
||||
|
@ -787,7 +803,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[8].pk).text().strip()
|
||||
== "{'error': 'PricingBookingNotCheckedError', 'error_details': {}}"
|
||||
== "{'error': 'PricingBookingNotCheckedError', 'error_details': {}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[9].pk).text())
|
||||
|
@ -795,7 +811,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[9].pk).text().strip()
|
||||
== "{'error': 'PricingMultipleBookingError', 'error_details': {}}"
|
||||
== "{'error': 'PricingMultipleBookingError', 'error_details': {}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[10].pk).text())
|
||||
|
@ -803,7 +819,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert (
|
||||
resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[10].pk).text().strip()
|
||||
== "{'error': 'PricingBookingCheckTypeError', 'error_details': {'reason': 'not-found'}}"
|
||||
== "{'error': 'PricingBookingCheckTypeError', 'error_details': {'reason': 'not-found'}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[11].pk).text())
|
||||
|
@ -811,7 +827,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[11].pk).text().strip() == (
|
||||
"{'error': 'PricingBookingCheckTypeError', 'error_details': {'check_type': 'foo-reason', "
|
||||
"'check_type_group': 'foo-bar', 'reason': 'not-configured'}}"
|
||||
"'check_type_group': 'foo-bar', 'reason': 'not-configured'}} {'event': 'foobar'}"
|
||||
)
|
||||
assert (
|
||||
format_status(resp.pyquery('tr[data-line-id="%s"] td.status' % lines[12].pk).text())
|
||||
|
@ -819,7 +835,7 @@ def test_journal_pool_lines(app, admin_user):
|
|||
)
|
||||
assert resp.pyquery('tr[data-details-for-line-id="%s"] td pre' % lines[12].pk).text().strip() == (
|
||||
"{'error': 'PricingBookingCheckTypeError', 'error_details': {'check_type': 'foo-reason', "
|
||||
"'check_type_group': 'foo-bar', 'reason': 'wrong-kind'}}"
|
||||
"'check_type_group': 'foo-bar', 'reason': 'wrong-kind'}} {'event': 'foobar'}"
|
||||
)
|
||||
|
||||
|
||||
|
@ -842,6 +858,7 @@ def test_delete_pool(app, admin_user):
|
|||
regie = Regie.objects.create(label='Foo')
|
||||
invoice = DraftInvoice.objects.create(date_issue=datetime.date.today(), regie=regie, pool=pool)
|
||||
DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
invoice=invoice,
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
|
|
@ -279,6 +279,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
)
|
||||
# ok, same campaign
|
||||
DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
total_amount=0,
|
||||
|
@ -331,6 +332,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
)
|
||||
# nok, already invoiced
|
||||
InvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 15),
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
total_amount=0,
|
||||
|
@ -350,6 +352,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
)
|
||||
# nok, other campaign
|
||||
DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 16),
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
total_amount=0,
|
||||
|
@ -508,6 +511,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
line1, line2, line3, line4, line5, line6 = lines
|
||||
assert isinstance(line1, DraftInvoiceLine)
|
||||
assert line1.invoice is None
|
||||
assert line1.event_date == datetime.date(2022, 9, 1)
|
||||
assert line1.slug == 'agenda-1@event-1'
|
||||
assert line1.label == 'Event 1'
|
||||
assert line1.quantity == 1
|
||||
|
@ -528,6 +532,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
assert line1.from_injected_line is None
|
||||
assert isinstance(line2, DraftInvoiceLine)
|
||||
assert line2.invoice is None
|
||||
assert line2.event_date == datetime.date(2022, 9, 2)
|
||||
assert line2.slug == 'agenda-1@event-2'
|
||||
assert line2.label == 'Event 2'
|
||||
assert line2.quantity == 1
|
||||
|
@ -548,6 +553,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
assert line2.from_injected_line is None
|
||||
assert isinstance(line3, DraftInvoiceLine)
|
||||
assert line3.invoice is None
|
||||
assert line3.event_date == datetime.date(2022, 9, 1)
|
||||
assert line3.slug == 'agenda-2@eveeent-1'
|
||||
assert line3.label == 'Eveeent 1'
|
||||
assert line3.quantity == 1
|
||||
|
@ -568,6 +574,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
assert line3.from_injected_line is None
|
||||
assert isinstance(line4, DraftInvoiceLine)
|
||||
assert line4.invoice is None
|
||||
assert line4.event_date == datetime.date(2022, 9, 2)
|
||||
assert line4.slug == 'agenda-2@eveeent-2'
|
||||
assert line4.label == 'Eveeent 2'
|
||||
assert line4.quantity == 1
|
||||
|
@ -588,6 +595,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
assert line4.from_injected_line is None
|
||||
assert isinstance(line5, DraftInvoiceLine)
|
||||
assert line5.invoice is None
|
||||
assert line5.event_date == injected_line2.event_date
|
||||
assert line5.slug == 'event-2022-09-01'
|
||||
assert line5.label == 'Event 2022-09-01'
|
||||
assert line5.quantity == 2
|
||||
|
@ -603,6 +611,7 @@ def test_get_invoice_lines_for_user_check_status(mock_pricing_data_event, mock_s
|
|||
assert line5.from_injected_line == injected_line2
|
||||
assert isinstance(line6, DraftInvoiceLine)
|
||||
assert line6.invoice is None
|
||||
assert line6.event_date == injected_line4.event_date
|
||||
assert line6.slug == 'event-2022-09-30'
|
||||
assert line6.label == 'Event 2022-09-30'
|
||||
assert line6.quantity == 3
|
||||
|
@ -820,6 +829,7 @@ def test_get_invoice_lines_for_user_check_status_pricing_error(mock_pricing_data
|
|||
line1, line2, line3 = lines
|
||||
assert isinstance(line1, DraftInvoiceLine)
|
||||
assert line1.invoice is None
|
||||
assert line1.event_date == datetime.date(2022, 9, 1)
|
||||
assert line1.slug == 'agenda@event-1'
|
||||
assert line1.label == 'Event 1'
|
||||
assert line1.quantity == 1
|
||||
|
@ -839,6 +849,7 @@ def test_get_invoice_lines_for_user_check_status_pricing_error(mock_pricing_data
|
|||
assert line1.pool == pool
|
||||
assert isinstance(line2, DraftInvoiceLine)
|
||||
assert line2.invoice is None
|
||||
assert line2.event_date == datetime.date(2022, 9, 2)
|
||||
assert line2.slug == 'agenda@event-2'
|
||||
assert line2.label == 'Event 2'
|
||||
assert line2.quantity == 0
|
||||
|
@ -858,6 +869,7 @@ def test_get_invoice_lines_for_user_check_status_pricing_error(mock_pricing_data
|
|||
assert line2.pool == pool
|
||||
assert isinstance(line3, DraftInvoiceLine)
|
||||
assert line3.invoice is None
|
||||
assert line3.event_date == datetime.date(2022, 9, 3)
|
||||
assert line3.slug == 'agenda@event-3'
|
||||
assert line3.label == 'Event 3'
|
||||
assert line3.quantity == 1
|
||||
|
@ -893,18 +905,21 @@ def test_get_all_invoice_lines(mock_user_lines):
|
|||
)
|
||||
|
||||
line1 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
total_amount=0,
|
||||
pool=pool,
|
||||
)
|
||||
line2 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
total_amount=0,
|
||||
pool=pool,
|
||||
)
|
||||
line3 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
total_amount=0,
|
||||
|
@ -1075,6 +1090,7 @@ def test_generate_invoices_from_lines():
|
|||
)
|
||||
|
||||
line_error = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-1'},
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
|
@ -1085,6 +1101,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
line1 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-1'},
|
||||
quantity=1,
|
||||
unit_amount=1,
|
||||
|
@ -1095,6 +1112,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
line2 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-1'},
|
||||
quantity=1,
|
||||
unit_amount=2,
|
||||
|
@ -1105,6 +1123,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
line3 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-2'},
|
||||
quantity=1,
|
||||
unit_amount=3,
|
||||
|
@ -1115,6 +1134,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
line4 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-2'},
|
||||
quantity=1,
|
||||
unit_amount=4,
|
||||
|
@ -1125,6 +1145,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
line5 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-3'},
|
||||
quantity=1,
|
||||
unit_amount=5,
|
||||
|
@ -1135,6 +1156,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
DraftInvoiceLine.objects.create( # not used for generation
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-3'},
|
||||
quantity=1,
|
||||
unit_amount=5,
|
||||
|
@ -1145,6 +1167,7 @@ def test_generate_invoices_from_lines():
|
|||
pool=pool,
|
||||
)
|
||||
line6 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
event={'agenda': 'agenda-4'}, # regie not configured
|
||||
quantity=1,
|
||||
unit_amount=6,
|
||||
|
@ -1166,6 +1189,7 @@ def test_generate_invoices_from_lines():
|
|||
regie=regie1,
|
||||
)
|
||||
line7 = DraftInvoiceLine.objects.create(
|
||||
event_date=datetime.date(2022, 9, 1),
|
||||
quantity=1,
|
||||
unit_amount=7,
|
||||
total_amount=7,
|
||||
|
|
|
@ -30,6 +30,7 @@ def test_invoice_total_amount(draft):
|
|||
|
||||
# line with error status, ignored
|
||||
line = line_model.objects.create(
|
||||
event_date=datetime.date.today(),
|
||||
invoice=invoice, # with invoice
|
||||
quantity=0,
|
||||
unit_amount=0,
|
||||
|
@ -80,6 +81,7 @@ def test_invoice_total_amount(draft):
|
|||
|
||||
# create line with invoice, status success
|
||||
line2 = line_model.objects.create(
|
||||
event_date=datetime.date.today(),
|
||||
invoice=invoice,
|
||||
quantity=1,
|
||||
unit_amount=20,
|
||||
|
@ -109,6 +111,7 @@ def test_invoice_total_amount(draft):
|
|||
|
||||
# create line without invoice, status success
|
||||
line3 = line_model.objects.create(
|
||||
event_date=datetime.date.today(),
|
||||
quantity=1,
|
||||
unit_amount=20,
|
||||
total_amount=20,
|
||||
|
|
Loading…
Reference in New Issue