Projet

Général

Profil

« Précédent | Suivant » 

Révision 724b950f

Ajouté par Mikaël Ates il y a plus de 10 ans

dossiers: allow to create a contact without address (fixes #3123).

Voir les différences:

calebasse/dossiers/forms.py
214 214
            self.fields['health_org'].initial = self.instance.health_center.large_regime.code + self.instance.health_center.health_fund + self.instance.health_center.code
215 215
        if self.patient:
216 216
            self.fields['addresses'].queryset = self.patient.addresses
217
            self.fields['addresses'].required = False
217 218

  
218 219
    def clean(self):
219 220
        cleaned_data = super(PatientContactForm, self).clean()
......
259 260
                cleaned_data['other_health_center'] = other_health_center
260 261
        return cleaned_data
261 262

  
263
    def save(self, commit=True):
264
        contact = super(PatientContactForm, self).save(commit=False)
265
        contact.clean()
266
        if commit:
267
            contact.save()
268
            if self.patient and not self.instance.addresses.all():
269
                self.patient.contacts.add(contact)
270
        return contact
262 271

  
263 272
class PatientAddressForm(ModelForm):
264 273

  
calebasse/dossiers/models.py
278 278
            null=True, blank=True)
279 279

  
280 280
    def __unicode__(self):
281
        return self.display_name
281
        return self.display_name or u"Non renseigné"
282 282

  
283 283
    def save(self, **kwargs):
284 284
        self.display_name = ''
calebasse/dossiers/templates/dossiers/patientrecord_update.html
149 149
        <button type="button" id="new-address-btn">Nouvelle adresse</button>
150 150
        <button type="button" id="new-contact-btn">Nouveau contact</button>
151 151

  
152
        {% for contact in object.contacts.all %}
153
            {% if not contact.addresses.all %}
154
            <div class="contact">
155
                <h4>{% if contact.gender == 1 %}M.{% elif contact.gender == 2 %}Mme{% endif %}
156
                    {{ contact.first_name }} <span class="lastname">{{ contact.last_name }}</span> {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
157
                <div class="right">Assuré
158
                    <input type="radio"
159
                    {% if object.policyholder.id == contact.id %} checked="checked" {% endif %}
160
                    id="id_policyholder-policyholder_{{ contact.id }}"
161
                    value="{{ contact.id }}"
162
                    class="policyholder-radio"
163
                    name="policyholder-policyholder">
164
                    <button type="button" data-id="{{ contact.id }}" data-address-id="{{ address.id }}" class="del-contact icon-minus" title="Supprimer"></button>
165
                    <button type="button" data-id="{{ contact.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
166
                </div>
167
                <div>
168
                    <ul>
169
                        {% if contact.parente %}
170
                            <li><label>Lien avec le patient :</label>
171
                            {{ contact.parente }}</li>
172
                        {% endif %}
173
                        {% if contact.mobile %}
174
                            <li>
175
                            <span class="icon-user-space">{{ contact.mobile }} (perso)</span>
176
                            </li>
177
                        {% endif %}
178
                        {% if contact.phone %}
179
                            <li>
180
                            <span class="icon-user-space">{{ contact.phone }} (pro)</span>
181
                            </li>
182
                        {% endif %}
183
                        {% if contact.email %}
184
                            <li>
185
                            <label>Courriel :</label>
186
                            {{ contact.email }}
187
                            </li>
188
                        {% endif %}
189
                        {% if contact.job %}
190
                            <li>
191
                            <label>Profession :</label>
192
                            {{ contact.job }}
193
                            </li>
194
                        {% endif %}
195
                        {% if contact.contact_comment %}
196
                            <li>
197
                            <label>Commentaire :</label>
198
                            {{ contact.contact_comment }}
199
                            </li>
200
                        {% endif %}
201
                        <li><label>Données d'assuré social</label>
202
<!--                            <button class="blind">détails</button>-->
203
                            <ul>
204
                            {% if contact.social_security_id %}
205
                                <li><label>Numéro d'assuré social :</label>
206
                                {{ contact.social_security_id }} {{ contact.get_control_key }}</li>
207
                            {% endif %}
208
                            {% if contact.birthdate %}
209
                                <li><label>Date de naissance :</label>
210
                                {{ contact.birthdate|date:"SHORT_DATE_FORMAT" }}</li>
211
                            {% endif %}
212
                            {% if contact.birthplace %}
213
                                <li><label>Lieu de naissance :</label>
214
                                {{ contact.birthplace }}</li>
215
                            {% endif %}
216
                            {% if contact.begin_rights %}
217
                                <li><label>Début de droits :</label>
218
                                {{ contact.begin_rights }}</li>
219
                            {% endif %}
220
                            {% if contact.end_rights %}
221
                                <li><label>Fin de droits :</label>
222
                                {{ contact.end_rights }}</li>
223
                            {% endif %}
224
                            {% if contact.health_center %}
225
                                <li><label>Centre de santé :</label>
226
                                {{ contact.health_center }} ({{ contact.health_center.address }} {{ contact.health_center.address_complement }} {{ contact.health_center.zip_code }} {{ contact.health_center.city }})</li>
227
                            {% endif %}
228
                            {% if contact.management_code %}
229
                                <li><label>Code de gestion :</label>
230
                                {{ contact.management_code }}</li>
231
                            {% endif %}
232
                            <li><label>Tiers-payant :</label>
233
                                {% if contact.thirdparty_payer %}
234
                                    Oui
235
                                {% else %}
236
                                    Non
237
                                {% endif %}
238
                            </li>
239
                            {% if contact.twinning_rank %}
240
                                <li><label>Rang (gémellité) :</label>
241
                                {{ contact.twinning_rank }}</li>
242
                            {% endif %}
243
                            </ul>
244
                        </li>
245
                    </ul>
246
                </div>
247
            </div>
248
            {% endif %}
249
        {% endfor %}
152 250
        {% for address in object.addresses.all %}
153 251
        <div class="frame">
154
            <h3>{% if not address.display_name %}Non renseigné{% else %}{{ address.display_name }}{% endif %}</h3>
252
            <h3>{{ address }}</h3>
155 253
            <div class="buttons">
156 254
                <button type="button" data-id="{{ address.id }}" class="del-address icon-minus" title="Supprimer"></button>
157 255
                <button type="button" data-id="{{ address.id }}" class="update-address-btn icon-edit" title="Modifier"></button>
......
165 263
            {% if not address.phone and not address.comment %}<p>&nbsp;<!-- intentionaly empty --></p>{% endif %}
166 264
            {% for contact in address.patientcontact_set.all  %}
167 265
            {% if contact.id != object.id %}
168
            <div class="contact{% if contact.id == object.id %} patient{% endif %}">
266
            <div class="contact">
169 267
                <h4>{% if contact.gender == 1 %}M.{% elif contact.gender == 2 %}Mme{% endif %}
170 268
                    {{ contact.first_name }} <span class="lastname">{{ contact.last_name }}</span> {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
171 269
                <div class="right">Assuré

Formats disponibles : Unified diff