From 8eb8d82396b249981949a5928f1afb58a502e26a Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Wed, 30 Mar 2016 18:10:17 +0200 Subject: [PATCH] lingo: show invoice payment mode details if present (#10483) Use invoice payment mode to define line style --- combo/apps/lingo/models.py | 10 ++++++++-- combo/apps/lingo/templates/lingo/combo/item.html | 3 +++ combo/apps/lingo/templates/lingo/combo/items.html | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py index 7f021de..0cb07a5 100644 --- a/combo/apps/lingo/models.py +++ b/combo/apps/lingo/models.py @@ -73,7 +73,9 @@ def build_remote_item(data, regie): subject=data.get('label'), has_pdf=data.get('has_pdf'), online_payment=data.get('online_payment'), - payment_date=data.get('payment_date')) + paid=data.get('paid'), + payment_date=data.get('payment_date'), + payment_mode=data.get('payment_mode')) class Regie(models.Model): @@ -232,7 +234,7 @@ class RemoteItem(object): def __init__(self, id, regie, creation_date, payment_limit_date, total_amount, amount, display_id, subject, has_pdf, - online_payment, payment_date): + online_payment, paid, payment_date, payment_mode): self.id = id self.regie = regie self.creation_date = parser.parse(creation_date) @@ -243,6 +245,10 @@ class RemoteItem(object): self.subject = subject self.has_pdf = has_pdf self.online_payment = online_payment + self.paid = paid + if payment_mode: + self.payment_mode = payment_mode + self.payment_mode_details = hasattr(settings, 'INVOICE_PAYMENT_MODES') and settings.INVOICE_PAYMENT_MODES.get(payment_mode) if payment_date: self.payment_date = parser.parse(payment_date) diff --git a/combo/apps/lingo/templates/lingo/combo/item.html b/combo/apps/lingo/templates/lingo/combo/item.html index 13b902e..3e783af 100644 --- a/combo/apps/lingo/templates/lingo/combo/item.html +++ b/combo/apps/lingo/templates/lingo/combo/item.html @@ -29,6 +29,9 @@ {% if item.payment_date %} {% endif %} + {% if item.payment_mode_details %} +
{% trans "Details:" %} {{ item.payment_mode_details }}
+ {% endif %} {% if item.online_payment and item.amount >= regie.payment_min_amount %} {% csrf_token %} diff --git a/combo/apps/lingo/templates/lingo/combo/items.html b/combo/apps/lingo/templates/lingo/combo/items.html index cd5342a..a0796a3 100644 --- a/combo/apps/lingo/templates/lingo/combo/items.html +++ b/combo/apps/lingo/templates/lingo/combo/items.html @@ -16,7 +16,7 @@ {% for item in items %} - + {{ item.display_id }} {{ item.subject }} {{ item.creation_date|date:"SHORT_DATE_FORMAT" }} -- 2.8.0.rc3