lingo: show invoice no online payment reason if present (#10483)
Use invoice no online payment reason to define line style
This commit is contained in:
parent
0c2cf86231
commit
f47f9b5734
|
@ -65,7 +65,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'),
|
||||
no_online_payment_reason=data.get('no_online_payment_reason'))
|
||||
|
||||
|
||||
class Regie(models.Model):
|
||||
|
@ -224,7 +226,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, no_online_payment_reason):
|
||||
self.id = id
|
||||
self.regie = regie
|
||||
self.creation_date = parser.parse(creation_date)
|
||||
|
@ -235,9 +237,18 @@ class RemoteItem(object):
|
|||
self.subject = subject
|
||||
self.has_pdf = has_pdf
|
||||
self.online_payment = online_payment
|
||||
self.paid = paid
|
||||
self.no_online_payment_reason = no_online_payment_reason
|
||||
if payment_date:
|
||||
self.payment_date = parser.parse(payment_date)
|
||||
|
||||
@property
|
||||
def no_online_payment_reason_details(self):
|
||||
reasons = {'litigation': _('This invoice is in ligitation.'),
|
||||
'autobilling': _('Autobilling has been set for this invoice.')}
|
||||
return settings.LINGO_NO_ONLINE_PAYMENT_REASONS.get(self.no_online_payment_reason,
|
||||
reasons.get(self.no_online_payment_reason))
|
||||
|
||||
|
||||
class Transaction(models.Model):
|
||||
regie = models.ForeignKey(Regie, null=True)
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
{% if item.payment_date %}
|
||||
<div class="paid">{% trans "Payed on:" %} <span class="timestamp">{{ item.payment_date|date:"SHORT_DATE_FORMAT" }}</span></div>
|
||||
{% endif %}
|
||||
{% if item.no_online_payment_reason_details %}
|
||||
<div class="no-online-payment-reason"><span>{{ item.no_online_payment_reason_details }}</span></div>
|
||||
{% endif %}
|
||||
{% if item.online_payment and item.amount >= regie.payment_min_amount %}
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="regie" value="{{ regie.pk }}" />
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{% for item in items %}
|
||||
<tr>
|
||||
<tr{% if item.no_online_payment_reason %} class='{{ item.no_online_payment_reason }}-invoice'{% endif %}>
|
||||
<td class="invoice-id">{{ item.display_id }}</td>
|
||||
<td class="invoice-subject">{{ item.subject }}</td>
|
||||
<td class="invoice-creation-date">{{ item.creation_date|date:"SHORT_DATE_FORMAT" }}</td>
|
||||
|
|
|
@ -241,6 +241,10 @@ MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
|||
|
||||
MELLON_IDENTITY_PROVIDERS = []
|
||||
|
||||
# mapping of payment modes
|
||||
LINGO_NO_ONLINE_PAYMENT_REASONS = {}
|
||||
|
||||
|
||||
local_settings_file = os.environ.get('COMBO_SETTINGS_FILE',
|
||||
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
||||
if os.path.exists(local_settings_file):
|
||||
|
|
Loading…
Reference in New Issue