Commit 3cdecb65 authored by Patrick Kimber's avatar Patrick Kimber

Is the customer for this invoice (or credit note) setup for on-account postings?

parent 6c772e15
Pipeline #138610526 passed with stage
in 5 minutes and 1 second
......@@ -514,6 +514,14 @@ class Invoice(TimedCreateModifyDeleteVersionModel):
]
return result
def on_account(self):
result = False
try:
result = bool(self.contact.invoicecontact.on_account)
except InvoiceContact.DoesNotExist:
pass
return result
def time_analysis(self):
"""Time analysis by user and ticket for an invoice.
......
......@@ -526,6 +526,22 @@ def test_number_prefix():
).save()
@pytest.mark.django_db
def test_on_account():
"""Is the customer setup for on-account postings?"""
contact = ContactFactory()
InvoiceContactFactory(contact=contact, on_account=True)
invoice = InvoiceFactory(contact=contact)
assert invoice.on_account() is True
@pytest.mark.django_db
def test_on_account_not():
"""Is the customer setup for on-account postings?"""
invoice = InvoiceFactory(contact=ContactFactory())
assert invoice.on_account() is False
@pytest.mark.django_db
def test_on_account_invoices():
date_before = date(2019, 3, 10)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment