Revision 2864e701 snf-astakos-app/astakos/quotaholder/models.py

b/snf-astakos-app/astakos/quotaholder/models.py
42 42
class Holding(Model):
43 43

  
44 44
    holder      =   CharField(max_length=4096, db_index=True)
45
    source      =   CharField(max_length=4096, null=True)
45 46
    resource    =   CharField(max_length=4096, null=False)
46 47

  
47 48
    capacity    =   intDecimalField()
......
49 50

  
50 51
    imported_min    =   intDecimalField(default=0)
51 52
    imported_max    =   intDecimalField(default=0)
52
    stock_min       =   intDecimalField(default=0)
53
    stock_max       =   intDecimalField(default=0)
54 53

  
55 54
    objects     =   ForUpdateManager()
56 55

  
57 56
    class Meta:
58
        unique_together = (('holder', 'resource'),)
57
        unique_together = (('holder', 'source', 'resource'),)
59 58

  
60 59

  
61 60
from datetime import datetime
......
67 66
class Commission(Model):
68 67

  
69 68
    serial      =   AutoField(primary_key=True)
70
    holder      =   CharField(max_length=4096, db_index=True)
71 69
    name        =   CharField(max_length=4096, null=True)
72 70
    clientkey   =   CharField(max_length=4096, null=False)
73 71
    issue_time  =   CharField(max_length=24, default=now)
......
79 77
    serial      =   ForeignKey( Commission,
80 78
                                to_field='serial',
81 79
                                related_name='provisions'   )
82

  
83
    holder      =   CharField(max_length=4096, db_index=True, null=True)
84
    resource    =   CharField(max_length=4096, null=False)
80
    holding     =   ForeignKey(Holding,
81
                               related_name='provisions')
85 82
    quantity    =   intDecimalField()
86 83

  
87 84
    objects     =   ForUpdateManager()
......
89 86
class ProvisionLog(Model):
90 87

  
91 88
    serial              =   BigIntegerField()
92
    source              =   CharField(max_length=4096, null=True)
93
    target              =   CharField(max_length=4096)
94
    name                =   CharField(max_length=4096)
89
    name                =   CharField(max_length=4096, null=True)
95 90
    issue_time          =   CharField(max_length=4096)
96 91
    log_time            =   CharField(max_length=4096)
92
    holder              =   CharField(max_length=4096)
93
    source              =   CharField(max_length=4096, null=True)
97 94
    resource            =   CharField(max_length=4096)
98
    source_capacity     =   intDecimalField(null=True)
99
    source_imported_min =   intDecimalField(null=True)
100
    source_imported_max =   intDecimalField(null=True)
101
    source_stock_min    =   intDecimalField(null=True)
102
    source_stock_max    =   intDecimalField(null=True)
103
    target_capacity     =   intDecimalField()
104
    target_imported_min =   intDecimalField()
105
    target_imported_max =   intDecimalField()
106
    target_stock_min    =   intDecimalField()
107
    target_stock_max    =   intDecimalField()
95
    capacity            =   intDecimalField()
96
    imported_min        =   intDecimalField()
97
    imported_max        =   intDecimalField()
108 98
    delta_quantity      =   intDecimalField()
109 99
    reason              =   CharField(max_length=4096)
110 100

  

Also available in: Unified diff