Oubli compat Py2 req (encore)

This commit is contained in:
Aurélien Delobelle 2016-09-01 01:02:15 +02:00
parent 9b5aeee83e
commit 94989b0ad2

View file

@ -12,6 +12,7 @@ from django.contrib.auth.models import User
from gestioncof.models import CofProfile from gestioncof.models import CofProfile
from django.utils.six.moves import reduce from django.utils.six.moves import reduce
from django.utils import timezone from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.db import transaction from django.db import transaction
from django.db.models import F from django.db.models import F
from django.core.cache import cache from django.core.cache import cache
@ -25,6 +26,7 @@ def default_promo():
now = date.today() now = date.today()
return now.month <= 8 and now.year-1 or now.year return now.month <= 8 and now.year-1 or now.year
@python_2_unicode_compatible
class Account(models.Model): class Account(models.Model):
cofprofile = models.OneToOneField( cofprofile = models.OneToOneField(
CofProfile, on_delete = models.PROTECT, CofProfile, on_delete = models.PROTECT,
@ -223,6 +225,7 @@ class AccountNegative(models.Model):
blank = True, null = True, default = None) blank = True, null = True, default = None)
comment = models.CharField(max_length = 255, blank = True) comment = models.CharField(max_length = 255, blank = True)
@python_2_unicode_compatible
class Checkout(models.Model): class Checkout(models.Model):
created_by = models.ForeignKey( created_by = models.ForeignKey(
Account, on_delete = models.PROTECT, Account, on_delete = models.PROTECT,
@ -254,6 +257,7 @@ class CheckoutTransfer(models.Model):
amount = models.DecimalField( amount = models.DecimalField(
max_digits = 6, decimal_places = 2) max_digits = 6, decimal_places = 2)
@python_2_unicode_compatible
class CheckoutStatement(models.Model): class CheckoutStatement(models.Model):
by = models.ForeignKey( by = models.ForeignKey(
Account, on_delete = models.PROTECT, Account, on_delete = models.PROTECT,
@ -315,12 +319,14 @@ class CheckoutStatement(models.Model):
balance=F('balance') - last_statement.balance_new + self.balance_new) balance=F('balance') - last_statement.balance_new + self.balance_new)
super(CheckoutStatement, self).save(*args, **kwargs) super(CheckoutStatement, self).save(*args, **kwargs)
@python_2_unicode_compatible
class ArticleCategory(models.Model): class ArticleCategory(models.Model):
name = models.CharField(max_length = 45) name = models.CharField(max_length = 45)
def __str__(self): def __str__(self):
return self.name return self.name
@python_2_unicode_compatible
class Article(models.Model): class Article(models.Model):
name = models.CharField(max_length = 45) name = models.CharField(max_length = 45)
is_sold = models.BooleanField(default = True) is_sold = models.BooleanField(default = True)
@ -393,6 +399,7 @@ class InventoryArticle(models.Model):
self.stock_error = self.stock_new - self.stock_old self.stock_error = self.stock_new - self.stock_old
super(InventoryArticle, self).save(*args, **kwargs) super(InventoryArticle, self).save(*args, **kwargs)
@python_2_unicode_compatible
class Supplier(models.Model): class Supplier(models.Model):
articles = models.ManyToManyField( articles = models.ManyToManyField(
Article, Article,