Fixed Form Vlidation

This commit is contained in:
Shubhankar45
2026-09-22 10:36:55 +00:00
parent 8fdd20b29f
commit 2ed3945b5d
2435 changed files with 892940 additions and 32 deletions
+22 -1
View File
@@ -71,7 +71,7 @@ PRINTED_HEADERS = {
"VALUE",
"CLOSING",
"SEC. VALUE",
"AUG. SALES",
"SALES",
"VALUE",
],
}
@@ -126,6 +126,27 @@ def test_product_lists_print_in_their_own_columns():
assert cells[1][:4] == ["2", "INTEZOLE-RD", "93.59", "4"]
def test_printing_every_month_together_renumbers_instead_of_repeating():
# Each stored the server's own month-reset numbering (1, 1) — printed side by side that
# would repeat, so a combined PDF is asked to renumber instead of trusting it.
rows = _rows("sales_projection", 0) + [
{**{c: "" for c in TABLES["sales_projection"]}, "serial_no": "1", "month": "August", "product_name": "VIVACELLIX-360"},
{**{c: "" for c in TABLES["sales_projection"]}, "serial_no": "1", "month": "September", "product_name": "INFEZOX-O"},
]
body = _ctx("sales_projection", rows, renumber=True)["grids"]["main"]["rows"]
assert [r["cells"][0] for r in body[:2]] == ["1", "2"]
# A single month's own PDF (no renumber) keeps the server's real stored numbers.
body = _ctx("sales_projection", rows, renumber=False)["grids"]["main"]["rows"]
assert [r["cells"][0] for r in body[:2]] == ["1", "1"]
def test_sales_projection_sales_column_names_the_actual_month():
rows = _rows("sales_projection", 2, month="September")
assert _ctx("sales_projection", rows)["grids"]["main"]["headers"][7] == "SEP. SALES"
# No month on any row (e.g. a blank template): a generic label, never a hardcoded month.
assert _ctx("sales_projection", _rows("sales_projection", 2))["grids"]["main"]["headers"][7] == "SALES"
def test_no_form_prints_dashboard_extras():
for table in TABLES:
ctx = _ctx(table, _rows(table, 2, pob="5", kilometers_km="9"))