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'
|
DEPOSIT = 'deposit'
|
||||||
WITHDRAW = 'withdraw'
|
WITHDRAW = 'withdraw'
|
||||||
INITIAL = 'initial'
|
INITIAL = 'initial'
|
||||||
|
EDIT = 'edit'
|
||||||
|
|
||||||
TYPE_ORDER_CHOICES = (
|
TYPE_ORDER_CHOICES = (
|
||||||
(PURCHASE, 'Achat'),
|
(PURCHASE, 'Achat'),
|
||||||
(DEPOSIT, 'Charge'),
|
(DEPOSIT, 'Charge'),
|
||||||
(WITHDRAW, 'Retrait'),
|
(WITHDRAW, 'Retrait'),
|
||||||
(INITIAL, 'Initial'),
|
(INITIAL, 'Initial'),
|
||||||
|
(EDIT, 'Édition'),
|
||||||
)
|
)
|
||||||
|
|
||||||
group = models.ForeignKey(
|
group = models.ForeignKey(
|
||||||
|
@ -527,7 +529,6 @@ class Operation(models.Model):
|
||||||
amount = models.DecimalField(
|
amount = models.DecimalField(
|
||||||
max_digits = 6, decimal_places = 2,
|
max_digits = 6, decimal_places = 2,
|
||||||
blank = True, default = 0)
|
blank = True, default = 0)
|
||||||
is_checkout = models.BooleanField(default = True)
|
|
||||||
# Optional
|
# Optional
|
||||||
article = models.ForeignKey(
|
article = models.ForeignKey(
|
||||||
Article, on_delete = models.PROTECT,
|
Article, on_delete = models.PROTECT,
|
||||||
|
@ -549,6 +550,14 @@ class Operation(models.Model):
|
||||||
max_digits = 6, decimal_places = 2,
|
max_digits = 6, decimal_places = 2,
|
||||||
blank = True, null = True, default = None)
|
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 GlobalPermissions(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
managed = False
|
managed = False
|
||||||
|
|
Loading…
Reference in a new issue