summaryrefslogtreecommitdiff
path: root/app/modules/invoices
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2022-07-03 20:21:02 +0200
committerMarius Peter <marius.peter@tutanota.com>2022-07-03 20:21:02 +0200
commiteba4c1a3113d24319bccc5c52d4d93838334bd31 (patch)
treefe95881d42a0b4191a9371f82eaf66b9390af047 /app/modules/invoices
parent5160b8a3ac9fc27c2b31206aed735a15de0099e9 (diff)
db now in models; modules.
Diffstat (limited to 'app/modules/invoices')
-rw-r--r--app/modules/invoices/forms.py10
-rw-r--r--app/modules/invoices/routes.py4
2 files changed, 6 insertions, 8 deletions
diff --git a/app/modules/invoices/forms.py b/app/modules/invoices/forms.py
index 74df40e..7e2bc50 100644
--- a/app/modules/invoices/forms.py
+++ b/app/modules/invoices/forms.py
@@ -8,7 +8,7 @@ from wtforms import (
IntegerField,
FloatField,
BooleanField,
- DateTimeField,
+ DateField,
)
from wtforms.validators import InputRequired, Length, NumberRange
@@ -19,14 +19,14 @@ class AddInvoice(FlaskForm):
customer_id = SelectField("Customer", choices=[])
invoice_id_alt = StringField("Alternative invoice ID")
customer_reference = StringField("Customer reference")
- date_billed = StringField("Date billed")
- date_due = StringField("Date due")
+ date_billed = DateField('Date billed', format='%Y-%m-%d')
+ date_due = DateField('Date due', format='%Y-%m-%d')
amount_net = FloatField("Amount without tax", default=0)
amount_gross = FloatField("Amount with tax", default=0)
amount_tax = FloatField("Amount of tax", default=0)
- submit = SubmitField("Add new Invoice")
+ submit = SubmitField("Add Invoice")
- def __init__(self):
+ def __init__(self, **kwargs):
super().__init__()
self.customer_id.choices = [
(cus.primary_key, cus.name) for cus in Customer.query.all()
diff --git a/app/modules/invoices/routes.py b/app/modules/invoices/routes.py
index b8a0a68..b6a4fd9 100644
--- a/app/modules/invoices/routes.py
+++ b/app/modules/invoices/routes.py
@@ -15,7 +15,7 @@ from flask import (
from flask_login import login_required, current_user
-from ... import db
+# from ... import db
from ...models import *
from .forms import *
@@ -31,8 +31,6 @@ def view():
page = request.args.get('page', 1, type=int)
invoices = Invoice.query.order_by(Invoice.primary_key.desc()).paginate(page=page, per_page=5)
module = "invoices"
- flash(f"Successfully accessed module {module}.", "info")
- flash(f"Still fighting against styling in {module}.", "error")
return render_template(
f"modules/{module}.html",
modules=modules,
Copyright 2019--2024 Marius PETER