mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
fix: added validations for return in POS
This commit is contained in:
parent
95bfa4d9ff
commit
96c2e4f0a7
@ -318,7 +318,8 @@ export default defineComponent({
|
||||
|
||||
if (
|
||||
(this.sinvDoc.grandTotal?.float as number) < 1 &&
|
||||
this.fyo.pesa(this.paidAmount.float).isZero()
|
||||
this.fyo.pesa(this.paidAmount.float).isZero() &&
|
||||
!this.sinvDoc.returnAgainst
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@ -334,7 +335,8 @@ export default defineComponent({
|
||||
disablePayButton(): boolean {
|
||||
if (
|
||||
(this.sinvDoc.grandTotal?.float as number) < 1 &&
|
||||
this.fyo.pesa(this.paidAmount.float).isZero()
|
||||
this.fyo.pesa(this.paidAmount.float).isZero() &&
|
||||
!this.sinvDoc.returnAgainst
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@ -345,6 +347,7 @@ export default defineComponent({
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
},
|
||||
|
@ -81,15 +81,20 @@ export function validateSinv(sinvDoc: SalesInvoice, itemQtyMap: ItemQtyMap) {
|
||||
return;
|
||||
}
|
||||
|
||||
validateSinvItems(sinvDoc.items as SalesInvoiceItem[], itemQtyMap);
|
||||
validateSinvItems(
|
||||
sinvDoc.items as SalesInvoiceItem[],
|
||||
itemQtyMap,
|
||||
sinvDoc.returnAgainst as string
|
||||
);
|
||||
}
|
||||
|
||||
function validateSinvItems(
|
||||
sinvItems: SalesInvoiceItem[],
|
||||
itemQtyMap: ItemQtyMap
|
||||
itemQtyMap: ItemQtyMap,
|
||||
isReturn?: string
|
||||
) {
|
||||
for (const item of sinvItems) {
|
||||
if (!item.quantity || item.quantity < 1) {
|
||||
if (!item.quantity || (item.quantity < 1 && !isReturn)) {
|
||||
throw new ValidationError(
|
||||
t`Invalid Quantity for Item ${item.item as string}`
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user