refactor: refs #8277 update invoice creation logic and adjust data filtering options
This commit is contained in:
parent
09d88e25ea
commit
e680cbc25d
src/pages/Entry
|
@ -172,7 +172,8 @@ const columns = computed(() => [
|
|||
name: 'accountType',
|
||||
options: entryAccounts.value,
|
||||
optionLabel: 'type',
|
||||
optionValue: 'code',
|
||||
optionValue: 'id',
|
||||
sortBy: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -247,7 +248,7 @@ async function preAccount() {
|
|||
params: { companyFk: firstRow.companyFk, year },
|
||||
})
|
||||
).data;
|
||||
return createInvoice(true);
|
||||
return createInvoice();
|
||||
} else if (dmsFk) {
|
||||
supplierRef = (
|
||||
await axios.get(`Dms/${dmsFk}`, {
|
||||
|
@ -284,16 +285,15 @@ async function uploadFile() {
|
|||
async function afterUploadFile({ reference }, res) {
|
||||
supplierRef = reference;
|
||||
dmsFk = res.data[0].id;
|
||||
await createInvoice(false);
|
||||
await createInvoice();
|
||||
}
|
||||
|
||||
async function createInvoice(isAgricultural) {
|
||||
async function createInvoice() {
|
||||
try {
|
||||
await axios.post(`Entries/preAccount`, {
|
||||
await axios.post(`Entries/addInvoiceIn`, {
|
||||
ids: selectedRows.value.map((entry) => entry.id),
|
||||
supplierRef,
|
||||
dmsFk,
|
||||
isAgricultural,
|
||||
});
|
||||
notify(t('entry.preAccount.success'), 'positive');
|
||||
} catch (e) {
|
||||
|
@ -333,7 +333,7 @@ async function createInvoice(isAgricultural) {
|
|||
/>
|
||||
<FetchData
|
||||
url="EntryAccounts"
|
||||
:filter="{ fields: ['code', 'type'] }"
|
||||
:filter="{ fields: ['id', 'type'] }"
|
||||
@on-fetch="(data) => (entryAccounts = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue