From 94989b0ad2f7d1254c3703f4656a9c850cbe493a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Thu, 1 Sep 2016 01:02:15 +0200 Subject: [PATCH] Oubli compat Py2 req (encore) --- kfet/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kfet/models.py b/kfet/models.py index c59be9e3..dd7001dc 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -12,6 +12,7 @@ from django.contrib.auth.models import User from gestioncof.models import CofProfile from django.utils.six.moves import reduce from django.utils import timezone +from django.utils.encoding import python_2_unicode_compatible from django.db import transaction from django.db.models import F from django.core.cache import cache @@ -25,6 +26,7 @@ def default_promo(): now = date.today() return now.month <= 8 and now.year-1 or now.year +@python_2_unicode_compatible class Account(models.Model): cofprofile = models.OneToOneField( CofProfile, on_delete = models.PROTECT, @@ -223,6 +225,7 @@ class AccountNegative(models.Model): blank = True, null = True, default = None) comment = models.CharField(max_length = 255, blank = True) +@python_2_unicode_compatible class Checkout(models.Model): created_by = models.ForeignKey( Account, on_delete = models.PROTECT, @@ -254,6 +257,7 @@ class CheckoutTransfer(models.Model): amount = models.DecimalField( max_digits = 6, decimal_places = 2) +@python_2_unicode_compatible class CheckoutStatement(models.Model): by = models.ForeignKey( Account, on_delete = models.PROTECT, @@ -315,12 +319,14 @@ class CheckoutStatement(models.Model): balance=F('balance') - last_statement.balance_new + self.balance_new) super(CheckoutStatement, self).save(*args, **kwargs) +@python_2_unicode_compatible class ArticleCategory(models.Model): name = models.CharField(max_length = 45) def __str__(self): return self.name +@python_2_unicode_compatible class Article(models.Model): name = models.CharField(max_length = 45) is_sold = models.BooleanField(default = True) @@ -393,6 +399,7 @@ class InventoryArticle(models.Model): self.stock_error = self.stock_new - self.stock_old super(InventoryArticle, self).save(*args, **kwargs) +@python_2_unicode_compatible class Supplier(models.Model): articles = models.ManyToManyField( Article,