Fix: Linea de Cero debe ser mayor a cero issue RedEcovida#57

This commit is contained in:
sinergia 2024-11-02 11:40:51 -05:00
parent 2a908d4e05
commit a90fb4d937

View File

@ -239,6 +239,16 @@
}, },
async submit() { async submit() {
if (this.$refs.form.validate()) { if (this.$refs.form.validate()) {
const hasInvalidQuantity = this.purchase.saleline_set.some(line => line.quantity <= 0);
if (hasInvalidQuantity) {
this.errorMessage = 'La cantidad de cada línea de compra debe ser mayor que cero.';
console.log(this.errorMessage);
return; // Detener el submit si hay cantidades inválidas
}
this.errorMessage = ''; // Limpiar el mensaje de error
try { try {
const response = await fetch('/don_confiao/api/sales/', { const response = await fetch('/don_confiao/api/sales/', {
method: 'POST', method: 'POST',