diff options
Diffstat (limited to 'app/modules/invoices/forms.py')
-rw-r--r-- | app/modules/invoices/forms.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/modules/invoices/forms.py b/app/modules/invoices/forms.py new file mode 100644 index 0000000..8ef7bd0 --- /dev/null +++ b/app/modules/invoices/forms.py @@ -0,0 +1,33 @@ +from flask_wtf import FlaskForm +from wtforms import ( + SubmitField, + SelectField, + HiddenField, + StringField, + PasswordField, + IntegerField, + FloatField, + BooleanField, + DateTimeField, +) +from wtforms.validators import InputRequired, Length, NumberRange + +from ...models import Customer + + +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") + 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") + + def __init__(self, **kwargs): + super().__init__() + self.customer_id.choices = [ + (cus.primary_key, cus.name) for cus in Customer.query.all() + ] |