From bb2b7637d5e42c8226e94139a492ceb0324b06af Mon Sep 17 00:00:00 2001 From: Gael Le Mignot Date: Mon, 11 May 2020 14:46:04 +0200 Subject: [PATCH] Added oral option on receipt --- teleforma/views/crfpa.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index c83fc6aa..cf5cfcf7 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -50,6 +50,8 @@ from django.forms.formsets import all_valid from django.core.exceptions import ValidationError from django.contrib.sites.models import Site +ORAL_OPTION_PRICE = 250 + def get_course_code(obj): if obj: return unicode(obj.code) @@ -674,12 +676,19 @@ class ReceiptPDFView(PDFTemplateResponseMixin, TemplateView): label += u"%d heures de formation du %s au %s" % (training.duration, period.date_begin.strftime('%d/%m/%Y'), period.date_end.strftime('%d/%m/%Y'),) - - + + if student.oral_1: + substract += ORAL_OPTION_PRICE + items.append({ 'label': label, 'unit_price': student.total_fees - substract - student.total_discount, 'amount': 1, 'discount': student.total_discount, }, ) + if student.oral_1: + items.append({ 'label': "Option langue", + 'unit_price': ORAL_OPTION_PRICE, + 'amount': 1, + 'discount': 0, }, ) for item in items: item['total'] = item['unit_price'] * item['amount'] if item['discount']: -- 2.39.5