2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 03:29:00 +00:00

fix: moved _validateHasReturnDocs to validations

This commit is contained in:
akshayitzme 2023-08-19 10:33:04 +05:30
parent f332b7153b
commit dad0729aae

View File

@ -198,6 +198,7 @@ export abstract class StockTransfer extends Transfer {
await validateBatch(this);
await validateSerialNumber(this);
await validateSerialNumberStatus(this);
await this._validateHasReturnDocs();
}
async afterSubmit() {
@ -207,11 +208,6 @@ export abstract class StockTransfer extends Transfer {
await this._updateItemsReturned();
}
async beforeCancel(): Promise<void> {
await super.beforeCancel();
await this._validateHasReturnDocs();
}
async afterCancel(): Promise<void> {
await super.afterCancel();
await updateSerialNumbers(this, true, this.isReturn);
@ -293,7 +289,7 @@ export abstract class StockTransfer extends Transfer {
}
async _validateHasReturnDocs() {
if (!this.name) {
if (!this.name || !this.isCancelled) {
return;
}