0001-lingo-show-invoice-no-online-payment-reason-details-.patch
combo/apps/lingo/models.py | ||
---|---|---|
73 | 73 |
subject=data.get('label'), |
74 | 74 |
has_pdf=data.get('has_pdf'), |
75 | 75 |
online_payment=data.get('online_payment'), |
76 |
payment_date=data.get('payment_date')) |
|
76 |
paid=data.get('paid'), |
|
77 |
payment_date=data.get('payment_date'), |
|
78 |
no_online_payment_reason=data.get('no_online_payment_reason')) |
|
77 | 79 | |
78 | 80 | |
79 | 81 |
class Regie(models.Model): |
... | ... | |
232 | 234 | |
233 | 235 |
def __init__(self, id, regie, creation_date, payment_limit_date, |
234 | 236 |
total_amount, amount, display_id, subject, has_pdf, |
235 |
online_payment, payment_date):
|
|
237 |
online_payment, paid, payment_date, no_online_payment_reason):
|
|
236 | 238 |
self.id = id |
237 | 239 |
self.regie = regie |
238 | 240 |
self.creation_date = parser.parse(creation_date) |
... | ... | |
243 | 245 |
self.subject = subject |
244 | 246 |
self.has_pdf = has_pdf |
245 | 247 |
self.online_payment = online_payment |
248 |
self.paid = paid |
|
249 |
self.no_online_payment_reason = no_online_payment_reason |
|
246 | 250 |
if payment_date: |
247 | 251 |
self.payment_date = parser.parse(payment_date) |
248 | 252 | |
253 |
@property |
|
254 |
def no_online_payment_reason_details(self): |
|
255 |
return settings.LINGO_NO_ONLINE_PAYMENT_REASONS.get(self.no_online_payment_reason) |
|
256 | ||
249 | 257 | |
250 | 258 |
class Transaction(models.Model): |
251 | 259 |
regie = models.ForeignKey(Regie, null=True) |
combo/apps/lingo/templates/lingo/combo/item.html | ||
---|---|---|
29 | 29 |
{% if item.payment_date %} |
30 | 30 |
<div class="paid">{% trans "Payed on:" %} <span class="timestamp">{{ item.payment_date|date:"SHORT_DATE_FORMAT" }}</span></div> |
31 | 31 |
{% endif %} |
32 |
{% with no_online_payment_reason_details=item.no_online_payment_reason_details %} |
|
33 |
{% if no_online_payment_reason_details %} |
|
34 |
<div class="details"><span>{{ no_online_payment_reason_details }}</span></div> |
|
35 |
{% endif %} |
|
36 |
{% endwith %} |
|
32 | 37 |
{% if item.online_payment and item.amount >= regie.payment_min_amount %} |
33 | 38 |
{% csrf_token %} |
34 | 39 |
<input type="hidden" name="regie" value="{{ regie.pk }}" /> |
combo/apps/lingo/templates/lingo/combo/items.html | ||
---|---|---|
16 | 16 |
</thead> |
17 | 17 |
<tbody> |
18 | 18 |
{% for item in items %} |
19 |
<tr> |
|
19 |
<tr{% if item.no_online_payment_reason %} class='{{ item.no_online_payment_reason }}-invoice'{% endif %}>
|
|
20 | 20 |
<td class="invoice-id">{{ item.display_id }}</td> |
21 | 21 |
<td class="invoice-subject">{{ item.subject }}</td> |
22 | 22 |
<td class="invoice-creation-date">{{ item.creation_date|date:"SHORT_DATE_FORMAT" }}</td> |
combo/settings.py | ||
---|---|---|
240 | 240 | |
241 | 241 |
MELLON_IDENTITY_PROVIDERS = [] |
242 | 242 | |
243 |
# mapping of payment modes |
|
244 |
LINGO_NO_ONLINE_PAYMENT_REASONS = {'litigation': _('This is a litigation invoice, thus not payable online'), |
|
245 |
'autobilling': _('This is an autobilling invoice, thus not payable online')} |
|
246 | ||
247 | ||
243 | 248 |
local_settings_file = os.environ.get('COMBO_SETTINGS_FILE', |
244 | 249 |
os.path.join(os.path.dirname(__file__), 'local_settings.py')) |
245 | 250 |
if os.path.exists(local_settings_file): |
246 |
- |