Commit initial, version 0.2
[auf_django_coda.git] / auf / django / coda / models.py
1 # encoding: utf-8
2
3 from django.conf import settings
4 from django.db import models
5
6
7 class Element(models.Model):
8 id = models.CharField(max_length=74, primary_key=True)
9 niveau = models.IntegerField()
10 code = models.CharField(max_length=72)
11 date_modification = models.DateField()
12 nom = models.CharField(max_length=36)
13
14 class Meta:
15 managed = False
16 db_table = 'coda_element'
17
18
19 class Ecriture(models.Model):
20 id = models.CharField(max_length=25, primary_key=True)
21 code = models.CharField(max_length=12)
22 numero = models.CharField(max_length=12)
23 date_modification = models.DateField()
24 periode = models.IntegerField()
25 annee = models.IntegerField()
26 date = models.DateField()
27
28 class Meta:
29 managed = False
30 db_table = 'coda_ecriture'
31
32
33 class LigneEcriture(models.Model):
34 DEBIT_CREDIT_CHOICES = (
35 ('D', 'Débit'),
36 ('C', 'Crédit'),
37 )
38 ETAT_PAIEMENT_CHOICES = (
39 ('D', 'D-Disponible'),
40 ('A', 'A-Attente'),
41 ('X', 'X-Fermé (non-lettrable)'),
42 ('P', 'P-Payé'),
43 ('O', 'O-Proposé'),
44 )
45
46 id = models.CharField(max_length=36, primary_key=True)
47 ecriture = models.ForeignKey(Ecriture, related_name='doclines')
48 numero = models.IntegerField()
49 date_modification = models.DateField()
50 compte_comptable = models.ForeignKey(Element, related_name='+', db_index=True)
51 tiers_operation = models.ForeignKey(Element, related_name='+', db_index=True)
52 projet_poste = models.ForeignKey(Element, related_name='+', db_index=True)
53 description = models.CharField(max_length=36)
54 montant_eur = models.DecimalField(max_digits=17, decimal_places=2)
55 debit_credit = models.CharField(max_length=1, choices=DEBIT_CREDIT_CHOICES)
56 numero_facture = models.CharField(max_length=32)
57 numero_avoir = models.CharField(max_length=32)
58 implantation = models.CharField(max_length=32)
59 salarie = models.CharField(max_length=32)
60 numero_cheque = models.CharField(max_length=32)
61 etat_paiement = models.CharField(max_length=1, choices=ETAT_PAIEMENT_CHOICES)
62
63 class Meta:
64 managed = False
65 db_table = 'coda_ligne_ecriture'