2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 03:19:01 +00:00

fix: serial number validation

This commit is contained in:
akshayitzme 2023-05-08 15:07:13 +05:30 committed by Alan
parent 299cd83cc9
commit f2bbe5479e
3 changed files with 12 additions and 0 deletions

View File

@ -145,6 +145,10 @@ export class StockMovement extends Transfer {
} }
async function validateSerialNumberStatus(doc: StockMovement) { async function validateSerialNumberStatus(doc: StockMovement) {
if (doc.isCancelled) {
return;
}
for (const { serialNumber, item } of getSerialNumberFromDoc(doc)) { for (const { serialNumber, item } of getSerialNumberFromDoc(doc)) {
const cannotValidate = !(await canValidateSerialNumber(item, serialNumber)); const cannotValidate = !(await canValidateSerialNumber(item, serialNumber));
if (cannotValidate) { if (cannotValidate) {

View File

@ -312,6 +312,10 @@ export abstract class StockTransfer extends Transfer {
} }
async function validateSerialNumberStatus(doc: StockTransfer) { async function validateSerialNumberStatus(doc: StockTransfer) {
if (doc.isCancelled) {
return;
}
for (const { serialNumber, item } of getSerialNumberFromDoc(doc)) { for (const { serialNumber, item } of getSerialNumberFromDoc(doc)) {
const cannotValidate = !(await canValidateSerialNumber(item, serialNumber)); const cannotValidate = !(await canValidateSerialNumber(item, serialNumber));
if (cannotValidate) { if (cannotValidate) {

View File

@ -52,6 +52,10 @@ async function validateItemRowBatch(
} }
export async function validateSerialNumber(doc: StockMovement | StockTransfer) { export async function validateSerialNumber(doc: StockMovement | StockTransfer) {
if (doc.isCancelled) {
return;
}
for (const row of doc.items ?? []) { for (const row of doc.items ?? []) {
await validateItemRowSerialNumber(row); await validateItemRowSerialNumber(row);
} }