mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 11:32:38 +02:00
Remove archiving features
This commit is contained in:
parent
f70d26a631
commit
10210272b6
3 changed files with 1 additions and 23 deletions
|
@ -281,7 +281,6 @@ class Delivery(PersistedBase):
|
|||
NEED_PRICE_UPDATE = 1
|
||||
OPEN = 2
|
||||
ADJUSTMENT = 3
|
||||
ARCHIVED = 4
|
||||
|
||||
name: str
|
||||
from_date: datetime_field
|
||||
|
@ -295,7 +294,6 @@ class Delivery(PersistedBase):
|
|||
producers: Dict[str, Producer] = field(default_factory=dict)
|
||||
orders: Dict[str, Order] = field(default_factory=dict)
|
||||
shipping: Dict[str, price_field] = field(default_factory=dict)
|
||||
is_archived: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
self.id = None # Not a field because we don't want to persist it.
|
||||
|
@ -305,8 +303,6 @@ class Delivery(PersistedBase):
|
|||
def status(self):
|
||||
if not self.products:
|
||||
return self.EMPTY
|
||||
if self.is_archived:
|
||||
return self.ARCHIVED
|
||||
if self.products_need_price_update():
|
||||
return self.NEED_PRICE_UPDATE
|
||||
if self.is_open:
|
||||
|
@ -369,7 +365,6 @@ class Delivery(PersistedBase):
|
|||
@classmethod
|
||||
def init_fs(cls):
|
||||
cls.get_root().mkdir(parents=True, exist_ok=True)
|
||||
cls.get_root().joinpath("archive").mkdir(exist_ok=True)
|
||||
|
||||
@classmethod
|
||||
def load(cls, id):
|
||||
|
@ -390,10 +385,6 @@ class Delivery(PersistedBase):
|
|||
id_ = str(path.relative_to(cls.get_root())).replace(".yml", "")
|
||||
yield Delivery.load(id_)
|
||||
|
||||
@classmethod
|
||||
def archived(cls):
|
||||
return [d for d in cls.all() if not d.is_archived]
|
||||
|
||||
@classmethod
|
||||
def incoming(cls):
|
||||
return sorted(
|
||||
|
@ -415,18 +406,6 @@ class Delivery(PersistedBase):
|
|||
self.id = uuid.uuid4().hex
|
||||
self.path.write_text(self.dump())
|
||||
|
||||
def archive(self):
|
||||
if self.is_archived:
|
||||
raise ValueError("La distribution est déjà archivée")
|
||||
self.is_archived = True
|
||||
|
||||
def unarchive(self):
|
||||
if not self.is_archived:
|
||||
raise ValueError(
|
||||
"Impossible de désarchiver une distribution qui n'est pas archivée"
|
||||
)
|
||||
self.is_archived = False
|
||||
|
||||
def product_wanted(self, product):
|
||||
total = 0
|
||||
for order in self.orders.values():
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{% if delivery.status == delivery.OPEN %}Commandes ouvertes jusqu'au {{ delivery.order_before|date }}
|
||||
{% elif delivery.status == delivery.ADJUSTMENT %}Ajustements en cours
|
||||
{% elif delivery.status == delivery.CLOSED %}Fermée
|
||||
{% elif delivery.status == delivery.ARCHIVED %}Archivée
|
||||
{% elif delivery.status == delivery.NEED_PRICE_UPDATE %}Mise à jour des prix*
|
||||
{% endif %}
|
|
@ -7,7 +7,7 @@ Vous êtes la personne référente pour une distribution, et vous vous demandez
|
|||
### Création d'une nouvelle distribution
|
||||
|
||||
La première chose à faire, c'est de créer une nouvelle distribution.
|
||||
Dans l'interface, en bas à gauche il y a un bouton « Nouvelle distribution ».
|
||||
Dans l'interface il y a un bouton « Nouvelle distribution ».
|
||||
|
||||
Il vous sera demandé quelques informations, puis vous pouvez valider.
|
||||
|
||||
|
|
Loading…
Reference in a new issue