facturation: prevent invoicing validation if previous invoicing is not validated.

This commit is contained in:
Mikaël Ates 2014-01-13 15:20:00 +01:00
parent 4f85a009b7
commit 0b6bb2cb85
2 changed files with 8 additions and 1 deletions

View File

@ -26,7 +26,7 @@
<a href="..">Retourner à la liste</a>
{% if service_name == "CMPP" %}
{% if invoicing.status == "open" %}<button id="close-invoicing">Clore cette facturation</button>{% endif %}
{% if invoicing.status == "closed" %}<button id="validate"">Valider cette facturation</button>{% endif %}
{% if invoicing.status == "closed" and previous_validated %}<button id="validate"">Valider cette facturation</button>{% endif %}
{% if invoicing.status == "validated" %}
<button onclick="window.location.href=window.location.href+'transmission/'">Télétransmission</button>
<button onclick="window.location.href=window.location.href+'export/'">Export comptabilité</button>

View File

@ -104,6 +104,13 @@ class FacturationDetailView(UpdateView):
context['len_patient_with_lost_acts_missing_birthdate'] = len_patient_with_lost_acts_missing_birthdate
context['some_stats'] = context['invoicing'].get_stats_per_price_per_year()
context['batches'] = context['invoicing'].get_batches()
previous_seq_id = context['invoicing'].seq_id - 1
try:
previous = Invoicing.objects.get(service= self.service, seq_id=previous_seq_id)
if previous.status == Invoicing.STATUS.validated:
context['previous_validated'] = True
except:
pass
elif self.service.name == 'CAMSP':
(len_patient_pause, len_patient_hors_pause,
len_acts_pause, len_acts_hors_pause, patients_stats,