feat(invoicing): artikelregister (product/article catalog) with per-article revenue account (#703)
* feat(invoicing): artikelregister (product/article catalog) with per-article revenue account Add a lean, non-inventory article catalog (artikelregister) so users can define reusable invoice-line presets (name, unit, price excl VAT, VAT rate) with an optional per-article BAS class-3 revenue-account override. - DB: articles table (RLS via user_company_ids(), audit + updated_at triggers, unique-per-company article_number), generate_article_number RPC (atomic + idempotent), company_settings counter, nullable invoice_items.revenue_account + article_id, pending_operations CHECK expansion. - Engine: generatePerRateLines groups revenue by (vat_rate, account) — byte-identical with no override, balance-safe when split (last account absorbs the rounding remainder), reverse_charge/export still force 3308/3305. - API: /api/articles CRUD (soft-deactivate); override validated against chart_of_accounts (active class-3) and frozen onto invoice lines at create. - Propagation: override carried through send/mark-sent/credit/convert/cash and the staged commit paths (recurring deferred — documented inline). - MCP: gnubok_list/create/update_article (staged, scoped, risk-tiered). - UI: articles register (list/detail/form) + nav + bilingual i18n + invoice-line article picker & "Spara som artikel" quick-create. - Tests: engine regression, route, and pg-real (RPC/RLS/triggers). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(mcp): strip ILIKE _ wildcard from gnubok_list_articles search Underscore is a single-character ILIKE wildcard; stripping it (alongside the existing %,()\* set) keeps a stray char in the article search from matching every row. Read-only + RLS-scoped, so no security impact — addresses PR #703 reviewer + compliance-swarm CC6.3 notes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
07ecb98389
commit
c0b006fcc1
@@ -71,6 +71,7 @@
|
||||
"invoices": "Invoices",
|
||||
"sales_orders": "Orders",
|
||||
"customers": "Customers",
|
||||
"articles": "Articles",
|
||||
"products": "Products",
|
||||
"inventory": "Inventory",
|
||||
"supplier_invoices": "Supplier invoices",
|
||||
@@ -2057,6 +2058,13 @@
|
||||
},
|
||||
"invoice_editor": {
|
||||
"back": "Back",
|
||||
"article_label": "Article",
|
||||
"article_placeholder": "Select article",
|
||||
"article_free_text": "Custom line (free text)",
|
||||
"save_as_article": "Save as article",
|
||||
"save_article_need_description": "Enter a description before saving as an article",
|
||||
"article_saved_title": "Article saved",
|
||||
"save_article_failed": "Could not save the article",
|
||||
"title_invoice": "New invoice",
|
||||
"title_proforma": "New proforma invoice",
|
||||
"title_delivery_note": "New delivery note",
|
||||
@@ -3460,6 +3468,106 @@
|
||||
"copy_banner_unknown_label": "(unknown number)",
|
||||
"copy_banner_body": "A new, standalone voucher will be created with its own voucher series and number. This is NOT a correction or reversal of the original — use \"Skapa ändringsverifikation\" if you want to correct the source voucher."
|
||||
},
|
||||
"articles": {
|
||||
"title": "Articles",
|
||||
"new_article": "New article",
|
||||
"add_article": "Add article",
|
||||
"viewer_disabled_tooltip": "You only have viewer access in this company",
|
||||
"load_failed_title": "Could not load articles",
|
||||
"load_failed_description": "Check your connection and try again.",
|
||||
"create_failed_title": "Could not create article",
|
||||
"created_title": "Article created",
|
||||
"created_description": "{name} has been added",
|
||||
"search_placeholder": "Search articles",
|
||||
"no_search_results_title": "No matches",
|
||||
"no_search_results_description": "No articles match \"{term}\".",
|
||||
"empty_title": "No articles yet",
|
||||
"empty_description": "Add articles for goods and services to fill in invoice rows quickly.",
|
||||
"empty_action": "Add article",
|
||||
"type_vara": "Goods",
|
||||
"type_tjanst": "Service",
|
||||
"status_active": "Active",
|
||||
"status_inactive": "Inactive",
|
||||
"per_unit": "per {unit}",
|
||||
"vat_label_value": "{rate} % VAT",
|
||||
"col_number": "Article number",
|
||||
"col_name": "Name",
|
||||
"col_type": "Type",
|
||||
"col_unit": "Unit",
|
||||
"col_price": "Price excl. VAT",
|
||||
"col_vat": "VAT",
|
||||
"col_status": "Status"
|
||||
},
|
||||
"article_detail": {
|
||||
"back": "Back to articles",
|
||||
"edit": "Edit",
|
||||
"deactivate": "Deactivate",
|
||||
"edit_dialog_title": "Edit article",
|
||||
"viewer_disabled_tooltip": "You only have viewer access in this company",
|
||||
"type_vara": "Goods",
|
||||
"type_tjanst": "Service",
|
||||
"status_active": "Active",
|
||||
"status_inactive": "Inactive",
|
||||
"section_pricing": "Pricing",
|
||||
"section_accounting": "Accounting",
|
||||
"section_details": "Details",
|
||||
"section_notes": "Notes",
|
||||
"label_price": "Price excl. VAT",
|
||||
"label_vat": "VAT",
|
||||
"label_unit": "Unit",
|
||||
"label_cost_price": "Cost price",
|
||||
"label_revenue_account": "Revenue account",
|
||||
"revenue_account_auto": "Derived automatically",
|
||||
"label_housework": "ROT/RUT",
|
||||
"label_name_en": "Name (English)",
|
||||
"label_ean": "EAN/barcode",
|
||||
"no_details": "No additional details",
|
||||
"load_failed_title": "Could not load article",
|
||||
"load_failed_description": "Article not found.",
|
||||
"updated_title": "Article updated",
|
||||
"update_failed_title": "Could not update article",
|
||||
"retry": "Please try again.",
|
||||
"deactivate_confirm_title": "Deactivate {name}",
|
||||
"deactivate_confirm_description": "The article is hidden from lists and invoice pickers but its history is kept. You can reactivate it later.",
|
||||
"deactivate_confirm_label": "Deactivate",
|
||||
"deactivated_title": "Article deactivated",
|
||||
"deactivate_failed_title": "Could not deactivate article"
|
||||
},
|
||||
"form_article": {
|
||||
"type_label": "Type *",
|
||||
"type_placeholder": "Choose type",
|
||||
"type_vara": "Goods",
|
||||
"type_tjanst": "Service",
|
||||
"name_label": "Name *",
|
||||
"name_placeholder": "E.g. Consulting hour",
|
||||
"name_required": "Name is required",
|
||||
"name_en_label": "Name (English)",
|
||||
"name_en_placeholder": "E.g. Consulting hour",
|
||||
"name_en_hint": "Used on English-language invoices.",
|
||||
"unit_label": "Unit",
|
||||
"price_label": "Price excl. VAT *",
|
||||
"price_required": "Enter a price",
|
||||
"vat_rate_label": "VAT",
|
||||
"advanced_section": "Advanced",
|
||||
"revenue_account_label": "Revenue account",
|
||||
"revenue_account_placeholder": "e.g. 3041",
|
||||
"revenue_account_hint": "Leave empty to derive the account automatically from the VAT rate.",
|
||||
"cost_price_label": "Cost price",
|
||||
"cost_price_hint": "Margin display only – never posted.",
|
||||
"ean_label": "EAN/barcode",
|
||||
"ean_placeholder": "e.g. 7350000000000",
|
||||
"housework_label": "ROT/RUT",
|
||||
"housework_placeholder": "Choose work type",
|
||||
"housework_none": "None",
|
||||
"housework_rot": "ROT",
|
||||
"housework_rut": "RUT",
|
||||
"housework_hint": "Pre-fills the work type on the invoice row for housework.",
|
||||
"notes_label": "Notes",
|
||||
"notes_placeholder": "Internal notes about the article...",
|
||||
"submit_save": "Save article",
|
||||
"submit_saving": "Saving...",
|
||||
"viewer_disabled_tooltip": "You only have viewer access in this company"
|
||||
},
|
||||
"customers": {
|
||||
"title": "Customers",
|
||||
"new_customer": "New customer",
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
"invoices": "Fakturor",
|
||||
"sales_orders": "Order",
|
||||
"customers": "Kunder",
|
||||
"articles": "Artiklar",
|
||||
"products": "Produkter",
|
||||
"inventory": "Lager",
|
||||
"supplier_invoices": "Leverantörsfakturor",
|
||||
@@ -2057,6 +2058,13 @@
|
||||
},
|
||||
"invoice_editor": {
|
||||
"back": "Tillbaka",
|
||||
"article_label": "Artikel",
|
||||
"article_placeholder": "Välj artikel",
|
||||
"article_free_text": "Egen rad (fri text)",
|
||||
"save_as_article": "Spara som artikel",
|
||||
"save_article_need_description": "Fyll i en beskrivning innan du sparar som artikel",
|
||||
"article_saved_title": "Artikel sparad",
|
||||
"save_article_failed": "Kunde inte spara artikeln",
|
||||
"title_invoice": "Ny faktura",
|
||||
"title_proforma": "Ny proformafaktura",
|
||||
"title_delivery_note": "Ny följesedel",
|
||||
@@ -3460,6 +3468,106 @@
|
||||
"copy_banner_unknown_label": "(okänt nummer)",
|
||||
"copy_banner_body": "Ett nytt, fristående verifikat skapas med egen verifikationsserie och nummer. Detta är inte en rättelse eller storno av originalet — använd \"Skapa ändringsverifikation\" om du vill korrigera källverifikatet."
|
||||
},
|
||||
"articles": {
|
||||
"title": "Artiklar",
|
||||
"new_article": "Ny artikel",
|
||||
"add_article": "Lägg till artikel",
|
||||
"viewer_disabled_tooltip": "Du har endast läsbehörighet i detta företag",
|
||||
"load_failed_title": "Kunde inte ladda artiklar",
|
||||
"load_failed_description": "Kontrollera din anslutning och försök igen.",
|
||||
"create_failed_title": "Kunde inte skapa artikel",
|
||||
"created_title": "Artikel skapad",
|
||||
"created_description": "{name} har lagts till",
|
||||
"search_placeholder": "Sök artiklar",
|
||||
"no_search_results_title": "Inga träffar",
|
||||
"no_search_results_description": "Inga artiklar matchar \"{term}\".",
|
||||
"empty_title": "Inga artiklar ännu",
|
||||
"empty_description": "Lägg till artiklar för varor och tjänster för att snabbt fylla i fakturarader.",
|
||||
"empty_action": "Lägg till artikel",
|
||||
"type_vara": "Vara",
|
||||
"type_tjanst": "Tjänst",
|
||||
"status_active": "Aktiv",
|
||||
"status_inactive": "Inaktiv",
|
||||
"per_unit": "per {unit}",
|
||||
"vat_label_value": "{rate} % moms",
|
||||
"col_number": "Artikelnummer",
|
||||
"col_name": "Benämning",
|
||||
"col_type": "Typ",
|
||||
"col_unit": "Enhet",
|
||||
"col_price": "Pris exkl. moms",
|
||||
"col_vat": "Moms",
|
||||
"col_status": "Status"
|
||||
},
|
||||
"article_detail": {
|
||||
"back": "Tillbaka till artiklar",
|
||||
"edit": "Redigera",
|
||||
"deactivate": "Inaktivera",
|
||||
"edit_dialog_title": "Redigera artikel",
|
||||
"viewer_disabled_tooltip": "Du har endast läsbehörighet i detta företag",
|
||||
"type_vara": "Vara",
|
||||
"type_tjanst": "Tjänst",
|
||||
"status_active": "Aktiv",
|
||||
"status_inactive": "Inaktiv",
|
||||
"section_pricing": "Pris",
|
||||
"section_accounting": "Bokföring",
|
||||
"section_details": "Detaljer",
|
||||
"section_notes": "Anteckningar",
|
||||
"label_price": "Pris exkl. moms",
|
||||
"label_vat": "Moms",
|
||||
"label_unit": "Enhet",
|
||||
"label_cost_price": "Inköpspris",
|
||||
"label_revenue_account": "Försäljningskonto",
|
||||
"revenue_account_auto": "Härleds automatiskt",
|
||||
"label_housework": "ROT/RUT",
|
||||
"label_name_en": "Benämning (engelska)",
|
||||
"label_ean": "EAN/streckkod",
|
||||
"no_details": "Inga ytterligare detaljer",
|
||||
"load_failed_title": "Kunde inte ladda artikel",
|
||||
"load_failed_description": "Artikeln hittades inte.",
|
||||
"updated_title": "Artikel uppdaterad",
|
||||
"update_failed_title": "Kunde inte uppdatera artikel",
|
||||
"retry": "Försök igen.",
|
||||
"deactivate_confirm_title": "Inaktivera {name}",
|
||||
"deactivate_confirm_description": "Artikeln döljs i listor och fakturaval men historiken bevaras. Du kan aktivera den igen senare.",
|
||||
"deactivate_confirm_label": "Inaktivera",
|
||||
"deactivated_title": "Artikel inaktiverad",
|
||||
"deactivate_failed_title": "Kunde inte inaktivera artikel"
|
||||
},
|
||||
"form_article": {
|
||||
"type_label": "Typ *",
|
||||
"type_placeholder": "Välj typ",
|
||||
"type_vara": "Vara",
|
||||
"type_tjanst": "Tjänst",
|
||||
"name_label": "Benämning *",
|
||||
"name_placeholder": "T.ex. Konsulttimme",
|
||||
"name_required": "Benämning krävs",
|
||||
"name_en_label": "Benämning (engelska)",
|
||||
"name_en_placeholder": "T.ex. Consulting hour",
|
||||
"name_en_hint": "Används på fakturor med engelskt språk.",
|
||||
"unit_label": "Enhet",
|
||||
"price_label": "Pris exkl. moms *",
|
||||
"price_required": "Ange ett pris",
|
||||
"vat_rate_label": "Moms",
|
||||
"advanced_section": "Avancerat",
|
||||
"revenue_account_label": "Försäljningskonto",
|
||||
"revenue_account_placeholder": "t.ex. 3041",
|
||||
"revenue_account_hint": "Lämna tomt för att härleda kontot automatiskt utifrån momsen.",
|
||||
"cost_price_label": "Inköpspris",
|
||||
"cost_price_hint": "Endast för marginalberäkning – bokförs aldrig.",
|
||||
"ean_label": "EAN/streckkod",
|
||||
"ean_placeholder": "t.ex. 7350000000000",
|
||||
"housework_label": "ROT/RUT",
|
||||
"housework_placeholder": "Välj arbetstyp",
|
||||
"housework_none": "Ingen",
|
||||
"housework_rot": "ROT",
|
||||
"housework_rut": "RUT",
|
||||
"housework_hint": "Förifyller arbetstyp på fakturaraden för husarbete.",
|
||||
"notes_label": "Anteckningar",
|
||||
"notes_placeholder": "Interna anteckningar om artikeln...",
|
||||
"submit_save": "Spara artikel",
|
||||
"submit_saving": "Sparar...",
|
||||
"viewer_disabled_tooltip": "Du har endast läsbehörighet i detta företag"
|
||||
},
|
||||
"customers": {
|
||||
"title": "Kunder",
|
||||
"new_customer": "Ny kund",
|
||||
|
||||
Reference in New Issue
Block a user