fix(documents): restrict advance invoice creation to projects
All checks were successful
Build and Release FEDEO / verify (push) Successful in 1m8s
Build and Release FEDEO / build-and-release (push) Successful in 6m24s

This commit is contained in:
2026-10-15 13:05:06 +02:00
parent 6eea3c0687
commit 5dc9e686fc
7 changed files with 200 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ const { parse } = require('@vue/compiler-sfc')
const { descriptor } = parse(fs.readFileSync(`${__dirname}/../pages/createDocument/edit/[[id]].vue`, 'utf8'))
const script = ts.createSourceFile('document-editor.js', descriptor.scriptSetup.content, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS)
const handlers = new Set(['normalizeEntityId', 'normalizeUnitId', 'normalizeCreatedDocumentRow', 'normalizeCreatedDocumentRows', 'normalizeTaxTypeValue', 'setupPage', 'setRowData'])
const handlers = new Set(['normalizeEntityId', 'normalizeUnitId', 'normalizeCreatedDocumentRow', 'normalizeCreatedDocumentRows', 'normalizeTaxTypeValue', 'originalDocumentType', 'canUseAdvanceInvoice', 'validateAdvanceInvoiceCreation', 'setupPage', 'setRowData'])
const source = script.statements
.filter(statement => ts.isVariableStatement(statement) && statement.declarationList.declarations.some(declaration => handlers.has(declaration.name.getText(script))))
.map(statement => statement.getText(script)).join('\n')
@@ -18,6 +18,8 @@ function fixture(unit) {
const product = { id: 20, name: 'Artikel', unit, selling_price: 10, tax_percentage: 19 }
const service = { id: 30, name: 'Leistung', unit, sellingPrice: 20, sellingPriceComposed: {}, taxPercentage: 19 }
const context = vm.createContext({
ref, computed: getter => ({ get value() { return getter() } }),
isTemplateMode: ref(false),
dayjs, uuidv4: () => 'row-id', console: { log() {} },
products: ref([product]), services: ref([service]),
productcategories: ref([]), servicecategories: ref([]),