From 9d1b0c4fa515bb8edfd286d579ab9aaaf5137b78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexis=20M=C3=83taireau?=
Date: Sat, 5 Oct 2019 22:52:41 +0200
Subject: [PATCH] Attach phone numbers to orders.
---
README.md | 6 +++---
copanier/__init__.py | 2 +-
copanier/models.py | 1 +
copanier/templates/place_order.html | 13 +++++++++++--
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 87298a8..bc801ba 100644
--- a/README.md
+++ b/README.md
@@ -14,13 +14,13 @@ The main differences are :
- Support for multiple producers (and persons to handle these producers)
- A concept of groups was added : multiple persons can belong to the same group (and create / edit orders).
- A minimal interface to add / remove / update products from the website.
-- Support for out of stock products.
+- Support out of stock products
- Automatically compute a settlement plan (using the [debts library](https://framagit.org/almet/debts))
- Remove paiement tracking (as it conflicts with auto-settlement of debts)
-- A special page with tools to ease delivery management
+- Add a page with tools to ease delivery management
- Drop support for CSV files
- Send emails to producers referents, with an order summary
-- Generation of PDF files rather than XLS files (for order summary, signing sheet and paiements repartition)
+- Generate PDF files rather than XLS files (for order summary, signing sheet and paiements repartition)
## Philosophy
diff --git a/copanier/__init__.py b/copanier/__init__.py
index cf06c5b..9272b8f 100644
--- a/copanier/__init__.py
+++ b/copanier/__init__.py
@@ -602,7 +602,7 @@ async def place_order(request, response, id):
return
form = request.form
- order = Order()
+ order = Order(phone_number=form.get('phone_number', ''))
for product in delivery.products:
try:
wanted = form.int(f"wanted:{product.ref}", 0)
diff --git a/copanier/models.py b/copanier/models.py
index 1949464..a4edb78 100644
--- a/copanier/models.py
+++ b/copanier/models.py
@@ -221,6 +221,7 @@ class ProductOrder(Base):
@dataclass
class Order(Base):
products: Dict[str, ProductOrder] = field(default_factory=dict)
+ phone_number : str = ""
def __getitem__(self, ref):
if isinstance(ref, Product):
diff --git a/copanier/templates/place_order.html b/copanier/templates/place_order.html
index 4e5065e..5fa63c0 100644
--- a/copanier/templates/place_order.html
+++ b/copanier/templates/place_order.html
@@ -1,11 +1,18 @@
{% extends "base.html" %}
{% block body %}
+{% set group_name = request.groups.groups[person.name].name %}
-
+
+
{% include "includes/delivery_head.html" %}
-