From e2fa5a87eb213e75945be8c276d22d0f8ae9995a Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 7 Mar 2025 13:19:58 +0100 Subject: [PATCH 1/7] fix: refs #8731 customerBalance and test --- .../components/CustomerNewPayment.vue | 66 +++++++++---------- .../integration/client/clientBalance.spec.js | 6 ++ 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/pages/Customer/components/CustomerNewPayment.vue b/src/pages/Customer/components/CustomerNewPayment.vue index 6ecccc544..2295b922b 100644 --- a/src/pages/Customer/components/CustomerNewPayment.vue +++ b/src/pages/Customer/components/CustomerNewPayment.vue @@ -74,26 +74,27 @@ onBeforeMount(() => { urlCreate.value = `Clients/${route.params.id}/createReceipt`; }); -function setPaymentType(accounting) { +function setPaymentType(data, accounting) { + data.bankFk = accounting.id; + console.log('accounting: ', accounting); if (!accounting) return; accountingType.value = accounting.accountingType; - initialData.description = []; - initialData.payed = Date.vnNew(); + console.log('accountingType.value: ', accountingType.value); + data.description = []; + data.payed = Date.vnNew(); isCash.value = accountingType.value.code == 'cash'; viewReceipt.value = isCash.value; if (accountingType.value.daysInFuture) - initialData.payed.setDate( - initialData.payed.getDate() + accountingType.value.daysInFuture, - ); + data.payed.setDate(data.payed.getDate() + accountingType.value.daysInFuture); + console.log('data.payed', data.payed); maxAmount.value = accountingType.value && accountingType.value.maxAmount; - if (accountingType.value.code == 'compensation') - return (initialData.description = ''); + if (accountingType.value.code == 'compensation') return (data.description = ''); let descriptions = []; if (accountingType.value.receiptDescription) descriptions.push(accountingType.value.receiptDescription); - if (initialData.description) descriptions.push(initialData.description); - initialData.description = descriptions.join(', '); + if (data.description) descriptions.push(data.description); + data.description = descriptions.join(', '); } const calculateFromAmount = (event) => { @@ -113,7 +114,8 @@ function onBeforeSave(data) { if (isCash.value && shouldSendEmail.value && !data.email) return notify(t('There is no assigned email for this client'), 'negative'); - data.bankFk = data.bankFk?.id; + // data.bankFk = data.bankFk?.id; + return data; } @@ -184,11 +186,10 @@ async function getAmountPaid() {