From e084f90c19e779592f6e3f14eb8f70a7287f0dad Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 15 May 2022 13:17:35 +0200 Subject: Modularization. --- app/modules/orders/forms.py | 35 +++++++++++++++++++++++++++++++++++ app/modules/orders/routes.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 app/modules/orders/forms.py create mode 100644 app/modules/orders/routes.py (limited to 'app/modules/orders') diff --git a/app/modules/orders/forms.py b/app/modules/orders/forms.py new file mode 100644 index 0000000..66ab47b --- /dev/null +++ b/app/modules/orders/forms.py @@ -0,0 +1,35 @@ +from flask_wtf import FlaskForm +from wtforms import ( + SubmitField, + SelectField, + HiddenField, + StringField, + PasswordField, + IntegerField, + FloatField, + BooleanField, + DateTimeField, +) +from wtforms.validators import InputRequired, Length, NumberRange + + +class AddOrder(FlaskForm): # TODO + name = StringField("Product name", validators=[InputRequired()]) + code_accounting = StringField("Accounting code", default=0) + unit_weight = FloatField("Unit weight", default=0) + price_net = FloatField("Price (net)", default=0) + price_gross = FloatField("Price (gross)", default=0) + tax_rate = FloatField("Tax rate", default=0) + submit = SubmitField("Add/Update Product") + + +class AddInvoice(FlaskForm): + invoice_id_alt = StringField("Alternative invoice ID") + customer_id = StringField("Customer ID") + customer_reference = StringField("Customer reference") + date_billed = StringField("Date billed") + date_due = StringField("Date due") + 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") diff --git a/app/modules/orders/routes.py b/app/modules/orders/routes.py new file mode 100644 index 0000000..4027a44 --- /dev/null +++ b/app/modules/orders/routes.py @@ -0,0 +1,30 @@ +# -*- mode: python; -*- + + +from flask import ( + Blueprint, + render_template, + send_file, + request, + redirect, + flash, + url_for, + jsonify, + abort, +) +from flask_login import login_required, current_user + + +# from datetime import datetime +import inspect + + + +from ... import db +from ...models import * +from .forms import * + + +orders = Blueprint("orders", __name__) + + -- cgit v1.2.3