Skip to main content

Batches: test plan

For: testers checking batches and expiry dates on the QA server: the product setting, purchases and GRN, sales and POS, returns, adjustments, reports and the Control Center. What to set up, and what to check at each step. Checks marked ⚠ failed on nova on 25-Nov-2026: log a bug if they fail again. The first full run found 16 bugs; the bug list is in the QA folder (Batch_E2E_Test_Cases_and_Bugs).

Set up once

Make these on the QA server, as in the Tester handbook: environments, test data and checks. Name every record QA … so it can be cleaned up.

You need

Why

Setting PUR.stockEvent = ON_BILL, then ON_GRN

Section B needs ON_BILL; section C needs ON_GRN. Put it back when you finish

Setting SAL.blockOutOfStockSales ON

Sales and POS refuse more than is in stock

Product setting "Batches and expiry dates" ON

The "Keep it in batches" switch shows on the product

A supplier and a customer named QA …

Never use a real supplier or customer: test bills stay on their account

Product T1: batches on, expiry not required

The normal case; blank batch number gets an automatic number

Product T2: batches on, expiry required, shelf life 30 days

Expiry rules, expiry from the made-on date

Product T3: no batches

The batch box must not appear

Product T4: variants (two sizes), batches on

Batches are kept per variant

Stock in batches that are live, near expiry and already expired

Expired stock cannot be sold; the reports flag it

A POS register with an open session

POS checks

Two branches

Only for the transfer and multi-branch checks

Read-only database access

Section J

A. Product and the batch switch

#

Check

Steps

Pass when

1

Create product with batch tracking on (expiry not required)

Save product › Read it back (QA BM Tracked A, SKU QABM-A, batchTracking true)

Saved; tracking on, no expiry rule

2

Create product without batch tracking

Save product (QA BM Plain, SKU QABM-P)

Saved with tracking off

3

Create product with batches, expiry required and shelf life 30

Save (QA BM Exp, SKU QABM-E, trackExpiry true, shelfLifeDays 30)

Saved with expiry rule and shelf life

4

Batch tracking is optional per product

Compare PR-01 and PR-02

Tracking is a choice, not forced

5

Duplicate SKU (exact and lower case)

Save a second product with SKU QABM-A, then qabm-a (QABM-A / qabm-a)

Refused

6

Duplicate product name

Save another product named QA BM Tracked A (QA BM Tracked A)

Refused

7

Expiry rule switched on while batch tracking is off

Save with trackExpiry true, batchTracking false (QA BM ExpNoTrack)

Refused or rule ignored

8

⚠ Negative shelf life

Save with batchTracking, trackExpiry, shelfLifeDays -5 (API) (shelfLifeDays -5)

Refused

9

⚠ Non-stockable product with batch tracking on

Save stockable false + batchTracking true (API) (QA BM Service)

Refused (a service has no stock)

10

⚠ Empty SKU

Save with SKU empty (API) (sku '')

Refused or auto-generated

11

Switch tracking ON for a product that has stock

Edit QA BM Plain (stock 1) › tracking on (stock 1)

Stock stays; shows as "no batch"

12

Switch tracking OFF for a product that has batches

Edit the same product › tracking off (1 unit in batch)

Batches closed; stock kept; sale works

13

Product form (UI): "Keep it in batches", expiry switch, shelf life field

Open New product, fill name, SKU, cost, price, Unit Piece, switch "Keep it in batches" on, Save (QA BM UI Product, SKU QABM-UI1)

Saved with batch tracking on

14

Variation product with batch tracking

Create a 2-variant product with batch tracking (API, copied from an existing variant product) (QA BM Variant, SKU QABM-V1 (2kg), QABM-V2 (1kg))

Tracking applies; batches per variant SKU

15

Setting "Batches and expiry dates" off hides the switch for new products

Turn the setting off and open New product

Switch hidden for new products only

16

Setting "Batches and expiry dates" and prefix

Settings › Product settings

Toggle default ON; "Batch number prefix" (default B, letters/digits/-/ only, max 20) appears when ON.

17

Setting off hides toggle only for new products

New product › Existing tracked product

New product: no toggle. Tracked product keeps it.

18

Prefix rules

Prefix with space, symbol, 21 chars

"Letters, digits, - and / only"; max 20.

B. Purchase (ON_BILL mode, stock comes in on the bill)

#

Check

Steps

Pass when

19

Purchase with a new batch number

Save bill, qty 10, batch QABM-A-B1, mfg 01-Oct-2026, exp 01-Oct-2027 (QA BM Tracked A qty 10)

Stock +10, batch created with 10

20

Same batch number again, same expiry

Bill qty 5, batch QABM-A-B1, same expiry (+5)

Batch B1 = 15

21

Same batch number with a different expiry

Bill qty 5, batch B1, expiry 01-Dec-2027

Refused

22

Different batch numbers of one product

Bill qty 4, batch QABM-A-B2, exp 01-Jun-2027 (+4)

New batch B2

23

Batch number in a different case

Bill qty 1, batch "qabm-a-b1" (+1)

Joins B1, no duplicate

24

Expiry before manufacture date

Batch mfg 01-Nov-2026, exp 01-Oct-2026

Refused

25

⚠ Batch quantities add up to less than the line (3 of 5)

Bill qty 5, batch qty 3 (API)

Refused (form blocks it)

26

Batch quantities add up to more than the line (6 of 5)

Bill qty 5, batch qty 6

Refused

27

Blank batch number gets an automatic number

Bill qty 2, batch number empty

Auto number from prefix

28

Tracked product, no batch given (API)

Bill qty 3, no batches

Auto batch (form does this)

29

Batch details on a product that is not tracked

Bill qty 5 of QA BM Plain with a batch

Ignored or refused

30

⚠ Zero quantity bill

Bill qty 0 (tracked and untracked) (qty 0)

Refused

31

⚠ Negative quantity bill

Bill qty -3 on tracked and untracked products (qty -3)

Refused

32

Negative batch quantity

Batch qty -2 with qty 5

Refused

33

Batch number of 51 characters

51 X characters

Refused (max 50)

34

Script text as batch number

"<script>alert(1)</script>"

Refused or shown as text

35

Expiry required product, no expiry

Bill qty 5 batch with no expiry (QA BM Exp)

Refused

36

Expiry derived from manufacture date + shelf life

Bill qty 5, mfg 01-Nov-2026, no expiry (shelf 30)

Expiry 01-Dec-2026

37

⚠ Expiry required product, no batch at all (API)

Bill qty 2, no batches

Refused (form blocks it)

38

Batch that is already expired

Bill qty 3, exp 01-Jun-2026

Allowed or warned (needs clarification)

39

Same batch number on different products

Batch "QABM-A-B1" on QA BM Exp as well

Allowed (batch is per product)

40

Different quantities and prices

Qty 2.5 PC; unit price 10

Unit Piece allows 1 decimal here

41

Purchase form (UI): batch dialog, date message, save

New purchase › QA Batch Supplier › add QA BM UI Product › Add batch: number QABM-UI-B2, made 01/11/2026, expires 01/10/2026 › then expires 01/10/2027 › Save (QABM-UI-B2, qty 1)

Message for bad dates; saved batch with stock

42

Edit quantity down 10 -> 8

Edit INV13, qty 8

Batch B1 and stock -2

43

Edit quantity up 8 -> 12 and move to another batch

Edit INV13 qty 12 batch B1, then batch B9

Batches follow the edit

44

Edit with bad expiry

Edit with mfg after expiry

Refused

45

Edit quantity to negative

Edit INV13 qty -5

Refused with a clear reason

46

Delete a purchase and check reversal

Delete INV14 (+5 B1)

Stock and batch reduced by 5

47

Delete a purchase that has returns

Delete INV13 (PRN1, PRN2 exist)

Blocked

48

⚠ Delete a purchase whose goods were sold (batch already empty)

Delete INV16 (+4 B2, B2 sold out)

Blocked, or clear warning

49

⚠ Delete a purchase when total stock is lower than the bill

Delete INV22 (qty 3) with 0.5 in stock

Blocked

50

⚠ Failed saves use up document numbers

Count ids around failed saves

No gaps

51

Parallel purchases into the same new batch

3 bills at once, batch R-PAR

One batch, quantities add up

C. GRN (ON_GRN mode, stock comes in on the GRN)

#

Check

Steps

Pass when

52

GRN refused while the setting is ON_BILL

Create GRN on nova as it was (QA BM Report)

Refused

53

GRN with a new batch

Bill qty 6 (no stock moves), GRN receive 4 with batch G-B1 exp 01-Mar-2027 (receive 4)

Stock +4, batch G-B1 = 4

54

Batch typed on the bill line carries into the GRN

Add batch on a bill line, open GRN

Carried over

55

⚠ GRN for an expiry-required product with no batch

Receive 1, no batches (QA BM Report)

Refused

56

⚠ GRN where batches add up to less than received (1 of 2)

Receive 2, batch qty 1

Refused

57

⚠ GRN receives more than the bill (bill 6)

Receive 5 when 7 already received, then 2 more (received 14 of 6)

Refused: more than ordered

58

GRN with existing batch number but other expiry / bad dates

Batch G-B1 expiry 01-May-2027; G-B2 mfg after expiry

Refused

59

GRN with the same batch again (rest of bill)

Receive 2, batch G-B2

Batch G-B2 grows

60

⚠ GRN with quantity 0

Receive 0

Refused

61

Void a GRN reverses stock and batch

Void GRN 8 (G-B1 4) and GRN 11 (G-B3 5)

Stock and batches back

62

Void the same GRN twice

Void GRN 8 again

Clear refusal

63

Re-test of 21-Nov GRN 400 ("batches add up to 1, more than 0 on the document")

GRN confirm with and without batch

Works

D. Sale

#

Check

Steps

Pass when

64

Sell tracked product, no batch picked

Sale qty 3, no batches (QA BM Tracked A)

"No batch" stock first

65

Automatic pick runs out of no-batch stock, then earliest expiry

Sale qty 4

2 no-batch + 2 from the earliest batch

66

Sell from a chosen batch

Sale qty 2 naming B1

B1 -2

67

Sell from two batches

Qty 3: B1 1 + B9 2

Split as asked

68

Batch quantity above line quantity

Line 2, batch 5

Refused

69

⚠ Chosen batch has less than asked (B2 has 6.5, ask 8)

Sale qty 8 naming B2 qty 8

Refused: "B2 has only 6.5"

70

Sell more than total stock

Qty 1000 (stock 12.5)

Refused

71

Zero and negative quantity

Qty 0; qty -2

Refused

72

Unknown batch number

Batch NOPE

Refused

73

Batch named for an untracked product

Sale of QA BM Plain naming a batch

Ignored or refused

74

Expired batch named directly

Sale naming QABM-E-OLD (expired 01-Jun-2026)

Refused

75

Sale bigger than sellable stock when some has expired

Qty 11 and 9 with 3 expired of 11

Refused with expired note

76

Automatic pick skips expired batch

Sale qty 3

Skips expired

77

Edit sale quantity down (2 -> 1)

Edit INV (sale 20) qty 1 naming B1

Unit goes back to the batch it came from

78

Edit sale quantity up (1 -> 3, batches not named)

Edit qty 3

Extra unit from earliest stock

79

Edit sale: change batch

B1 › B9

Moved

80

Cancel sale restores stock to its batches

Cancel sale 20 and sale 29

Back into same batches

81

Cancel a cancelled sale

Cancel again

Refused

82

Parallel sales of the same stock

6 sales of 2 at once, 9 sellable

No oversell, no negative batch

83

Sale screen shows batch menu, expired batch greyed

Open Add Sale, scan QABM-R, open batch menu

Menu lists earliest first, expired disabled

84

Stock count on the sale line

Read "10 in stock" (3 expired of 10)

Count of sellable stock (clarify)

85

Batch printed on sale invoice

Download receipt of sale 21 (PDF)

Batch text under the line

86

Delete (hard) sale

-

-

E. POS

#

Check

Steps

Pass when

87

POS sale, batch picked automatically

POS sale qty 1 (QA BM Report)

Earliest live batch R-FAR

88

POS sale naming a batch

Qty 3 naming R-PAR (QA BM Report)

R-PAR -3

89

POS insufficient stock

Qty 20 (QA BM Report)

Refused

90

POS expired batch named

Naming R-EXP (QA BM Report)

Refused

91

POS with only expired stock left behind

Qty 4 with 3 sellable (QA BM Report)

Refused with expired note

92

Edit POS sale

Sale 39: 3 › 2, then 2 › 5 (QA BM Report)

Batch follows

93

Cancel POS sales

Cancel sales 38 and 39 (QA BM Report)

Stock back to batches

94

POS screen (register, scanner, batch menu)

Drive the POS page (QA BM Report)

Batch menu works on POS

F. Returns (sale return and purchase return)

#

Check

Steps

Pass when

95

Partial sales return

Return 1 of sale 21 (B1 1 + B9 2)

Back into the batch it came from

96

Second partial return

Return 1

Next batch of the sale

97

Return the rest (full)

Return 1

B9 +1; fully returned

98

Return above sold quantity

Return 5; then 1 after full

Refused

99

Return into a batch that has expired since the sale

Sell 2 from R-PAR, set its expiry to a past date, return 1 on that invoice, restore the date

Goes back to that batch

100

No-bill (blind) return of a tracked product

Return 1 with no invoice

Goes to "no batch"

101

Accounting after return

Check journal and customer balance

Matches

102

Purchase return, batch-wise (no batch picked)

Return 2 of INV13

Taken from the batches the bill filled

103

Purchase return naming a batch

Return 1 naming B1

Taken from B1

104

Return more than purchased

Return 50 of 12

Refused

105

Return with unknown batch / zero / negative quantity

Batch NOPE; qty 0; qty -2

Refused

G. Stock adjustment, Batches tab and transfer

#

Check

Steps

Pass when

106

Product stock = sum of batches + no-batch part

Compare stock and batches after each step

Never less than the batches

107

Adjust stock +5 into a new batch (screen)

Product › Adjust stock › 5 › Put it in a batch › QABM-UI-B1, expiry 01/05/2027 › Save › open Batches tab (QA BM UI Product)

Batch created with 5

108

Write off expired batch

Adjust -3 from the expired batch

Batch -3

109

Adjust with expiry before manufacture

mfg 20-Nov, exp 01-Oct

Refused

110

⚠ Adjust more than is on hand

Adjust -100 with stock 13

Refused (negative stock)

111

Adjust a batch for more than it holds

-2 from a batch at 0

Refused

112

Adjust +0

Adjust 0

Refused

113

Put existing no-batch stock into a batch

Assign 1 into QABM-P-B1

Batch made, stock same

114

Put more into batches than is in no batch

Assign 5 with 0 free

Refused

115

Edit batch: duplicate, blank, 51 chars, expiry<mfg, change quantity

PUT batch

Refused except valid edits; quantity not changed

116

Stock transfer of a batch-tracked product

Create a transfer with QA BM Report (API)

Moves batches, or clear refusal

117

Stock valuation and stock report

Stock report for QA BM products (QA BM Report stock 10 at cost 10)

Report agrees with stock

118

Stock transfer of a product that is not tracked

Transfer between two branches

Moves stock

119

Label from batch

Choose From batch

Fills batch no., expiry and packing date; newest batch prefilled.

H. Reports and Control Center

#

Check

Steps

Pass when

120

Batch expiry report and totals

Report with 30 days, with/without expired (Batches 3 expired, 4 near, 5 far)

Expired and near listed; totals match

121

Stock history shows batches

Open history of QA BM Report

Each row has its batch; totals match

122

Control Center expiry block

Open Dashboard, compare with the expiry API (30 days)

Counts match the list

123

⚠ Stock history totals agree with stock

Open stock history of a product that had GRNs (QA BM Report) and compare units in minus units out with stock on hand (QA BM Report)

In minus out = stock

I. Server rules and other checks

#

Check

Steps

Pass when

124

Empty batch number

Covered by PU-09

-

125

Concurrent purchase and sale on the same stock

Covered by SA-19 and PU-36

Consistent

126

Multi-location sale and return

Sell from location B

Picker lists batches of the document location.

127

Date around midnight

Expiry today

Expiry today counts as "soon" (sellable), not expired; no off-by-one near 00:00.

128

Tracking call fails

Add a tracked line on purchase

Code swallows the error: batch requirement may silently disappear. Should show an error.

J. Data checks (database, read only)

#

Check

Steps

Pass when

129

Batch master rows

Run query B1 from Batch_E2E_Test_Plan.md

Clean

130

Product-to-batch mapping

Run query B2 from Batch_E2E_Test_Plan.md

Clean

131

Purchase-to-batch mapping

Run query B3 from Batch_E2E_Test_Plan.md

Clean

132

Sales-to-batch mapping

Run query B4 from Batch_E2E_Test_Plan.md

Clean

133

Batch quantity = sum of movements

Run query B5 from Batch_E2E_Test_Plan.md

Clean

134

Duplicate rows

Run query B6 from Batch_E2E_Test_Plan.md

Clean

135

Consistency after edit/delete/return

Run query B7 from Batch_E2E_Test_Plan.md

Clean

  • Purchases: test plan
  • Purchase returns: test plan
  • Products: test plan
  • Stock transfers: test plan
  • Control Center (dashboard): test plan
  • Tester handbook: environments, test data and checks