[Flask] Simple ERP for a farm.
1
# -*- mode: python; -*-
2
3
from flask_wtf import FlaskForm
4
from wtforms import (
5
SubmitField,
6
SelectField,
7
HiddenField,
8
StringField,
9
PasswordField,
10
IntegerField,
11
FloatField,
12
BooleanField,
13
DateTimeField,
14
)
15
from wtforms.validators import InputRequired, Length, NumberRange
16
17
18
classLoginForm(FlaskForm):
19
username = ("Username",validators=[()])
20
password = ("Password",validators=[()])
21
remember = ("Remember")
22
submit = ("Login")
23
24
25
classRegisterForm(LoginForm):
26
name_first = ("First name")
27
name_last = ("Last name")
28
email = ("E-mail address")
29
phone_mobile = ("Phone number (mobile)")
30
phone_alternative = ("Phone number (alternative)")
31
submit = ("Register")
32
33
34
classAddCustomer(FlaskForm):
35
name = ("Customer name",validators=[()])
36
name_alternative = ("Alternative name")
37
# date_time_created = DateTimeField("Creation date")
38
code_customer = ("Customer code")
39
code_accounting = ("Accounting code")
40
address = ("Address")
41
postal_code = ("Postal Code")
42
city = ("City")
43
country = ("Country")
44
phone = ("Phone")
45
website = ("Website")
46
email = ("E-mail")
47
professional_id_1 = ("Professional ID 1")
48
professional_id_2 = ("Professional ID 2")
49
tax_id = ("Tax ID")
50
payment_terms = ("Payment Terms",default="Tu vas payer sale chien!")
51
submit = ("Add/Update Product")
52
53
54
classAddProduct(FlaskForm):
55
name = ("Product name",validators=[()])
56
code_accounting = ("Accounting code",default=0)
57
unit_weight = ("Unit weight",default=0)
58
price_net = ("Price (net)",default=0)
59
price_gross = ("Price (gross)",default=0)
60
tax_rate = ("Tax rate",default=0)
61
submit = ("Add/Update Product")
62
63
64
classAddFertilog(FlaskForm):
65
target = (
66
"Type",
67
choices=[("False","Log"),("True","Target")],
68
validators=[()],
69
)
70
nno3 = ("NNO3",default=0)
71
p = ("P",default=0)
72
k = ("K",default=0)
73
ca = ("Ca",default=0)
74
mg = ("Mg",default=0)
75
s = ("S",default=0)
76
na = ("Na",default=0)
77
cl = ("Cl",default=0)
78
fe = ("Fe",default=0)
79
zn = ("Zn",default=0)
80
b = ("B",default=0)
81
mn = ("Mn",default=0)
82
cu = ("Cu",default=0)
83
mo = ("Mo",default=0)
84
si = ("Si",default=0)
85
nnh4 = ("NNH4",default=0)
86
submit = ("Add/Update Log")
87
88
89
classAddFertitarget(AddFertilog):
90
targeted_log = (
91
"Log to target",
92
choices=[("value1","Last"),("value2","Named")],
93
validators=[()],
94
)
95
submit = ("Add/Update Log")
96
97
98
99
classAddOrder(FlaskForm): # TODO
100
name = ("Product name",validators=[()])
101
code_accounting = ("Accounting code",default=0)
102
unit_weight = ("Unit weight",default=0)
103
price_net = ("Price (net)",default=0)
104
price_gross = ("Price (gross)",default=0)
105
tax_rate = ("Tax rate",default=0)
106
submit = ("Add/Update Product")
107
108
109
classAddInvoice(FlaskForm):
110
invoice_id_alt = ("Alternative invoice ID")
111
customer_id = ("Customer ID")
112
customer_reference = ("Customer reference")
113
date_billed = ("Date billed")
114
date_due = ("Date due")
115
amount_net = ("Amount without tax",default=0)
116
amount_gross = ("Amount with tax",default=0)
117
amount_tax = ("Amount of tax",default=0)
118
submit = ("Add new Invoice")
119