feat(erpsetup): quotes name the Leistungsbeschreibung versions; Prüfwerk 1.0.3 #117

Merged
sharang merged 3 commits from feat/erp-lb-versions-2 into main 2026-11-09 10:25:59 +00:00
5 changed files with 115 additions and 23 deletions

No files matched your search

+5 -5
View File
@@ -16,7 +16,7 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0
go.opentelemetry.io/otel/sdk v1.47.0
go.opentelemetry.io/otel/trace v1.47.0
golang.org/x/crypto v0.57.0
golang.org/x/crypto v0.58.0
)
require (
@@ -87,11 +87,11 @@ require (
go.opentelemetry.io/otel/metric v1.47.0 // indirect
go.opentelemetry.io/proto/otlp v1.11.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/net v0.60.0 // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.23.0 // indirect
golang.org/x/sys v0.48.0 // indirect
golang.org/x/text v0.42.0 // indirect
golang.org/x/sync v0.24.0 // indirect
golang.org/x/sys v0.49.0 // indirect
golang.org/x/text v0.43.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260928230214-8a89bd6388cc // indirect
google.golang.org/grpc v1.83.2 // indirect
+12 -12
View File
@@ -202,23 +202,23 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M=
golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA=
golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU=
golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
+8 -4
View File
@@ -99,7 +99,7 @@ func emailTemplateDoc() map[string]any {
return map[string]any{
"doctype": "Email Template", "name": emailTemplateRE, "enabled": 1,
"reference_doctype": "Sales Invoice",
"subject": "Rechnung {{ name }} – BreakPilot",
"subject": "Rechnung {{ name }} – Breakpilot",
"use_html": 1, "response_html": invoiceMailHTML,
}
}
@@ -111,6 +111,7 @@ var brand = strings.NewReplacer(
"$REGISTER_BR", "Sitz Bodman-Ludwigshafen<br>Amtsgericht Freiburg, HRB 736403",
"$DIRECTORS_BR", "Geschäftsführer:<br>Benjamin Bönisch<br>Sharang Deepak Parnerkar",
"$REGISTER", legalRegister, "$DIRECTORS", legalDirectors,
"$LB_VERSIONS", lbVersionsJinja(),
)
// logoPNG is the chevron from the portal favicon (120×115, rendered from
@@ -131,7 +132,7 @@ func logoFileDoc() map[string]any {
}
}
const logoSVG = `<img alt="BreakPilot" width="30" height="29" style="display:block;" src="` + logoFileURL + `">`
const logoSVG = `<img alt="Breakpilot" width="30" height="29" style="display:block;" src="` + logoFileURL + `">`
// Shared Jinja: the company's own address and its bank account.
const companyVars = `{%- set bp_addr = frappe.db.get_value("Address", {"is_your_company_address": 1, "is_primary_address": 1, "disabled": 0}, ["address_line1", "pincode", "city", "email_id"], as_dict=1) or {"address_line1": "In Steinäckern 16", "pincode": "78351", "city": "Bodman-Ludwigshafen", "email_id": "kontakt@breakpilot.com"} -%}
@@ -319,7 +320,10 @@ var documentHTML = brand.Replace(`{%- set is_inv = doc.doctype == "Sales Invoice
{%- endif %}
{%- if more_users %}{% if pw_overage %} {% endif %}Weitere Nutzer über die enthaltenen Nutzer hinaus werden je Modul nach Preisliste berechnet (Leistungsbeschreibung Breakpilot Plattform, Abschnitt 4).{% endif %}</td></tr>
{%- endif %}
<tr><td class="k">Vertragsgrundlagen</td><td>{{ doc.get("vertragsgrundlage") or "Es gelten die SaaS-Vertragsbedingungen, die Leistungsbeschreibungen, das SLA und die AVV (Art. 28 DSGVO) in der jeweils vereinbarten Fassung. Auf Anfrage erhalten Sie die Dokumente vorab; nach Vertragsschluss stehen sie im BreakPilot-Kundenportal zum Abruf bereit." }}</td></tr>
{#- The Leistungsbeschreibungen by module and version (catalog.go lbVersions):
each LB says the version named in the quote applies. -#}
{%- set lb_versions = $LB_VERSIONS -%}
<tr><td class="k">Vertragsgrundlagen</td><td>{{ doc.get("vertragsgrundlage") or ("Es gelten die SaaS-Vertragsbedingungen, die Leistungsbeschreibungen (" ~ lb_versions ~ "), das SLA und die AVV (Art. 28 DSGVO) in der jeweils vereinbarten Fassung. Auf Anfrage erhalten Sie die Dokumente vorab; nach Vertragsschluss stehen sie im Breakpilot-Kundenportal zum Abruf bereit.") }}</td></tr>
<tr><td class="k">Annahme</td><td>Durch schriftliche oder elektronische Annahme dieses Angebots{% if doc.valid_till %} bis zum {{ frappe.utils.formatdate(doc.valid_till) }}{% endif %}.</td></tr>
</table>
</div>
@@ -366,7 +370,7 @@ var invoiceMailHTML = brand.Replace(`<div style="font-family:Arial,Helvetica,san
<p>Bei Fragen zur Rechnung antworten Sie einfach auf diese E-Mail.</p>
<table style="font-size:13px;line-height:1.5;color:$INK;border-collapse:collapse;margin-top:18px;"><tr><td>
<div style="font-size:12px;color:#71769B;">Mit freundlichen Grüßen</div>
<div style="font-size:16px;font-weight:bold;margin:1px 0 10px;">Ihr BreakPilot-Team</div>
<div style="font-size:16px;font-weight:bold;margin:1px 0 10px;">Ihr Breakpilot-Team</div>
<div style="font-weight:bold;">{{ company }}</div>
<div style="color:#43466A;">In Steinäckern 16, 78351 Bodman-Ludwigshafen</div>
<div style="color:#43466A;"><a href="mailto:kontakt@breakpilot.com" style="color:$ACCENT;text-decoration:none;">kontakt@breakpilot.com</a> · <a href="https://www.breakpilot.com" style="color:$ACCENT;text-decoration:none;">www.breakpilot.com</a></div>
+42 -2
View File
@@ -1,15 +1,55 @@
package erpsetup
import "strings"
// The sales catalogue in ERPNext: the SKU items (codes as in the registry's
// products table and the "Breakpilot SKU + SLA" sheet), their units and item
// group, the SEPA direct-debit mandate on the Customer and the payment method.
// Names, descriptions and list prices follow the Leistungsbeschreibungen
// 1.0.0. Every run writes the item description and creates what is missing;
// (versions in lbVersions). Every run writes the item description and creates what is missing;
// a list price (net EUR) goes on the Standard Selling price list once. Only a
// run with -sync-catalog (Config.SyncCatalog) brings existing items' name,
// description and disabled flag and the list prices back to these values;
// without it, price changes made in ERPNext stay.
// lbVersions are the frozen Leistungsbeschreibungen a quote names under
// "Vertragsgrundlagen" (each LB's § 1: "Maßgeblich ist die im Angebot …
// genannte Version"). The platform's applies to every quote; a module's when
// the quote has a line whose code starts with one of its prefixes. Raise a
// version here when a new one is frozen in Sellable Documents/
// Leistungsbeschreibung/<version>/FINAL.
var lbVersions = []struct {
Module, Version string
Prefixes []string // item code prefixes; none = every quote
}{
{"Breakpilot Plattform", "1.0.0", nil},
{"Prüfwerk", "1.0.3", []string{"CRA-CSA-CLD-"}},
{"Managed Git", "1.0.0", []string{"INF-GIT-CLD-"}},
{"Build-Runner", "1.0.0", []string{"INF-CI-CLD-"}},
{"Werkpilot", "1.0.0", []string{"DEV-WP-"}},
{"Firmwerk", "1.0.0", []string{"DEV-FWK-"}},
}
// lbVersionsJinja is a Jinja expression for the quote template: the names
// and versions of the Leistungsbeschreibungen that apply, comma-separated.
// It reads item_codes (" CODE CODE … ", set by the template).
func lbVersionsJinja() string {
var parts []string
for _, lb := range lbVersions {
name := lb.Module + " " + lb.Version
if len(lb.Prefixes) == 0 {
parts = append(parts, `"`+name+`"`)
continue
}
var conds []string
for _, p := range lb.Prefixes {
conds = append(conds, `" `+p+`" in item_codes`)
}
parts = append(parts, `(", `+name+`" if `+strings.Join(conds, " or ")+` else "")`)
}
return strings.Join(parts, " ~ ")
}
// itemGroup keeps its old spelling: renaming it would touch every item.
const itemGroup = "BreakPilot Abonnements"
@@ -38,7 +78,7 @@ func skus() []sku {
{Code: "PLT-CORE-CLD-ENT", Name: "Breakpilot Plattform – Enterprise", UOM: "Monat", Description: "Arbeitsbereich ohne Nutzergrenze, Enterprise-Support und benannte Ansprechperson.", Price: 1990},
{Code: "PLT-BNDL-CLD-STD", Name: "Breakpilot Starter-Modulpaket", UOM: "Monat", Description: "Plattform Starter (bis 25 Nutzer) mit drei Modulen nach Wahl, je bis 15 Nutzer. Die gewählten Module stehen im Angebot als eigene Positionen zu 0,00 €.", Price: 990},
{Code: "PLT-BNDL-CLD-ADD", Name: "Weiteres Modul im Starter-Modulpaket", UOM: "Monat", Description: "Ein weiteres Modul zum Starter-Modulpaket, bis 15 Nutzer. Das Modul steht im Angebot als eigene Position zu 0,00 €.", Price: 499},
{Code: "CRA-CSA-CLD-STD", Name: "Prüfwerk Cloud – Standard", UOM: "Monat", Description: "Automatisierte Sicherheitsanalyse von Quellcode, Firmware und SPS-Programmen: 5 enthaltene Prüfobjekte mit unbegrenzten Prüfungen nach Änderungen, dazu 100 weitere Prüfungen im Monat.", Price: 490},
{Code: "CRA-CSA-CLD-STD", Name: "Prüfwerk Cloud – Standard", UOM: "Monat", Description: "Automatisierte Sicherheitsanalyse von Quellcode, Firmware und SPS-Programmen mit SBOM und Codegraph: 5 enthaltene Prüfobjekte mit unbegrenzten Prüfungen nach Änderungen, dazu 100 weitere Prüfungen im Monat.", Price: 490},
{Code: "CRA-CSA-CLD-BUS", Name: "Prüfwerk Cloud – Business", UOM: "Monat", Description: "Prüfwerk mit 25 enthaltenen Prüfobjekten und 500 weiteren Prüfungen im Monat.", Price: 1290},
{Code: "CRA-CSA-CLD-ENT", Name: "Prüfwerk Cloud – Enterprise", UOM: "Monat", Description: "Prüfwerk ohne Begrenzung der Prüfobjekte und Prüfungen. Preis nach Vereinbarung.", Price: 0},
{Code: "CRA-CSA-CLD-TGT", Name: "Prüfwerk – Zusätzliches Prüfobjekt", UOM: "Monat", Description: "Prüfobjekt über die im Leistungspaket enthaltenen hinaus; seine Prüfungen zählen zum Monatskontingent. Berechnet wird die höchste Zahl gleichzeitig angelegter zusätzlicher Prüfobjekte im Monat.", Price: 5.99},
+48
View File
@@ -761,3 +761,51 @@ func TestTotalsPrintTheTaxAfterDiscount(t *testing.T) {
}
}
}
// The quote names the Leistungsbeschreibungen by module and version: each LB
// says the version named in the quote applies.
func TestQuoteNamesLBVersions(t *testing.T) {
for _, want := range []string{
`{%- set lb_versions = "Breakpilot Plattform 1.0.0" ~ (", Prüfwerk 1.0.3" if " CRA-CSA-CLD-" in item_codes else "")`,
`(", Managed Git 1.0.0" if " INF-GIT-CLD-" in item_codes else "")`,
`(", Build-Runner 1.0.0" if " INF-CI-CLD-" in item_codes else "")`,
`(", Werkpilot 1.0.0" if " DEV-WP-" in item_codes else "")`,
`(", Firmwerk 1.0.0" if " DEV-FWK-" in item_codes else "")`,
`"Es gelten die SaaS-Vertragsbedingungen, die Leistungsbeschreibungen (" ~ lb_versions ~ "), das SLA`,
"im Breakpilot-Kundenportal zum Abruf bereit.",
} {
if !strings.Contains(documentHTML, want) {
t.Errorf("quote template lacks %q", want)
}
}
if strings.Contains(documentHTML, "$LB_VERSIONS") || strings.Contains(documentHTML, "BreakPilot-Kundenportal") {
t.Error("placeholder left or old brand spelling in the Vertragsgrundlagen")
}
// item_codes must be set before the Vertragsgrundlagen row reads it.
if strings.Index(documentHTML, "{%- set item_codes") > strings.Index(documentHTML, "{%- set lb_versions") {
t.Error("lb_versions is computed before item_codes is set")
}
for _, lb := range lbVersions {
if !strings.Contains(documentHTML, lb.Module+" "+lb.Version) {
t.Errorf("quote template lacks %s %s", lb.Module, lb.Version)
}
}
if !strings.Contains(have(t, "CRA-CSA-CLD-STD").Description, "Codegraph") {
t.Error("Prüfwerk Standard description does not name the code graph (LB Prüfwerk 1.0.3 § 4 Abs. 4)")
}
}
// What customers read is spelled "Breakpilot": the documents, the letter
// head and footer, and the invoice e-mail with its subject. ERPNext record
// names (print formats, letter head, item group) keep the old spelling,
// because renaming them would create new records.
func TestCustomerTextSpellsBreakpilot(t *testing.T) {
for name, s := range map[string]string{
"document": documentHTML, "letter head": letterHeadHTML, "letter footer": letterFooterHTML,
"invoice mail": invoiceMailHTML, "logo": logoSVG, "mail subject": emailTemplateDoc()["subject"].(string),
} {
if strings.Contains(s, "BreakPilot") {
t.Errorf("%s still spells BreakPilot", name)
}
}
}