Commit 0227df9a authored by jocelyn's avatar jocelyn

Merge branch 'fix-inline-paiment-creation' into 'master'

Fix inline paiement creation in the context of not using the auto accounting mechanism

Closes #210

See merge request ffdn/coin!7
parents e1033cb5 35acd271
......@@ -426,6 +426,12 @@ class Payment(models.Model):
amount_to_pay = invoice.amount_remaining_to_pay()
amount_to_allocate = min(amount_can_pay, amount_to_pay)
if amount_to_allocate <= 0:
"No amount to allocate from payment {} to invoice {}".format(, invoice.number))
"Allocating {} from payment {} to invoice {}".format(
amount_to_allocate,, invoice.number))
......@@ -597,7 +603,15 @@ def payment_changed(sender, instance, created, **kwargs):
# this member
if (created or instance.amount_not_allocated() != 0) \
and (instance.member is not None):
# Not using the auto-accounting module ... and apparently the user did chose explicitly to which invoice
if not settings.HANDLE_BALANCE and instance.invoice:
# Otherwise, if we know to which member to use this payment for, we trigger an update of its accounting
elif instance.member is not None:
@receiver(post_save, sender=Invoice)
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