- Added `check_invoice_number_exists` method in `EconomicService` to verify invoice numbers in e-conomic journals. - Introduced `quick_analysis_on_upload` method in `OllamaService` for extracting critical fields from uploaded PDFs, including CVR, document type, and document number. - Created migration script to add new fields for storing detected CVR, vendor ID, document type, and document number in the `incoming_files` table. - Developed comprehensive tests for the quick analysis functionality, validating CVR detection, document type identification, and invoice number extraction.
14 lines
849 B
SQL
14 lines
849 B
SQL
-- Migration 012: Add default product category to templates
|
|
-- Allows templates to specify default category for line items (varesalg, drift, etc.)
|
|
|
|
ALTER TABLE supplier_invoice_templates
|
|
ADD COLUMN IF NOT EXISTS default_product_category VARCHAR(50) DEFAULT 'varesalg',
|
|
ADD COLUMN IF NOT EXISTS default_product_group_number INTEGER;
|
|
|
|
-- Valid categories: varesalg, drift, anlæg, abonnement, lager, udlejning
|
|
COMMENT ON COLUMN supplier_invoice_templates.default_product_category IS 'Default kategori for varelinjer: varesalg, drift, anlæg, abonnement, lager, udlejning';
|
|
COMMENT ON COLUMN supplier_invoice_templates.default_product_group_number IS 'Default e-conomic produktgruppe nummer';
|
|
|
|
-- Add index for category lookups
|
|
CREATE INDEX IF NOT EXISTS idx_supplier_invoice_templates_category ON supplier_invoice_templates(default_product_category);
|