forked from DGNum/gestioCOF
Remove is_checkout field from Operation model
This commit is contained in:
parent
a057869d77
commit
cadaf43131
1 changed files with 10 additions and 1 deletions
|
@ -510,12 +510,14 @@ class Operation(models.Model):
|
|||
DEPOSIT = 'deposit'
|
||||
WITHDRAW = 'withdraw'
|
||||
INITIAL = 'initial'
|
||||
EDIT = 'edit'
|
||||
|
||||
TYPE_ORDER_CHOICES = (
|
||||
(PURCHASE, 'Achat'),
|
||||
(DEPOSIT, 'Charge'),
|
||||
(WITHDRAW, 'Retrait'),
|
||||
(INITIAL, 'Initial'),
|
||||
(EDIT, 'Édition'),
|
||||
)
|
||||
|
||||
group = models.ForeignKey(
|
||||
|
@ -527,7 +529,6 @@ class Operation(models.Model):
|
|||
amount = models.DecimalField(
|
||||
max_digits = 6, decimal_places = 2,
|
||||
blank = True, default = 0)
|
||||
is_checkout = models.BooleanField(default = True)
|
||||
# Optional
|
||||
article = models.ForeignKey(
|
||||
Article, on_delete = models.PROTECT,
|
||||
|
@ -549,6 +550,14 @@ class Operation(models.Model):
|
|||
max_digits = 6, decimal_places = 2,
|
||||
blank = True, null = True, default = None)
|
||||
|
||||
@property
|
||||
def is_checkout(self):
|
||||
return (self.type == DEPOSIT or
|
||||
self.type == WITHDRAW or
|
||||
(self.type == PURCHASE and self.group and
|
||||
self.group.on_acc.is_cash)
|
||||
)
|
||||
|
||||
class GlobalPermissions(models.Model):
|
||||
class Meta:
|
||||
managed = False
|
||||
|
|
Loading…
Reference in a new issue