Vaihe 1/2: asiakkaat, yhteyshenkilöt ja laskutusyksiköt

- customers-moduuli Clean Architecture -kerroksin: asiakas (yritys/kuluttaja),
  Y-tunnuksen tarkiste ja yksilöllisyys, yhteyshenkilöt, laskutusyksiköt
  (verkkolaskuosoite vaatii välittäjätunnuksen)
- henkilötunnus salattuna (Fernet) ja HMAC-tiiviste päällekkäisyyksiin;
  pääkäyttäjä ja johto näkevät ja poistavat, muut näkevät peitettynä
- sisäinen asiakas data-migraatiolla, ei poistettavissa
- yleinen poistonesto käänteisten relaatioiden perusteella (tulevat
  PROTECT-viiteavaimet estävät poiston automaattisesti)
- asiakkaan sivu: lisäys ja muokkaus dialogissa HTMX:llä, fokuksen hallinta
  ja ruudunlukijailmoitukset; HTMX näyttää nyt 422-validointivirheet
- testit: domain, application, integraatio ja selaintestit (axe);
  yhteiset fixturet apps/conftest.py:hin, FakeUnitOfWork shared-moduuliin
- import-linter: moduulien riippumattomuussäännöt
- dokumentit päivitetty

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-29 13:47:09 +02:00
co-authored by Claude Opus 5.5
parent e7b2745916
commit a81c073d6a
68 changed files with 3470 additions and 144 deletions
+40
View File
@@ -0,0 +1,40 @@
from django.utils.translation import gettext_lazy as _
from apps.customers.domain.enums import CustomerType
TYPE_LABELS = {
CustomerType.COMPANY: _("Company"),
CustomerType.CONSUMER: _("Consumer"),
}
TYPE_CHOICES = [(t.value, label) for t, label in TYPE_LABELS.items()]
ERROR_MESSAGES = {
"invalid_customer_name": _("Enter a name (at most 200 characters)."),
"invalid_business_id": _("Enter a valid business ID, for example 1234567-1."),
"invalid_personal_id": _("Enter a valid personal identity code."),
"consumer_cannot_have_business_id": _("A consumer cannot have a business ID."),
"company_cannot_have_personal_id": _("A company cannot have a personal identity code."),
"internal_customer_must_be_company": _("The internal customer is always a company."),
"business_id_taken": _("Another customer already has this business ID."),
"personal_id_taken": _("Another customer already has this personal identity code."),
"personal_id_removal_not_allowed": _(
"You are not allowed to remove the personal identity code."
),
"customer_not_found": _("The customer was not found."),
"customer_in_use": _(
"The customer cannot be deleted because it has contacts, billing units, jobs, "
"sales or invoices."
),
"internal_customer_cannot_be_deleted": _("The internal customer cannot be deleted."),
"invalid_contact_name": _("Enter a name (at most 150 characters)."),
"invalid_billing_unit_name": _("Enter a name (at most 200 characters)."),
"invalid_e_invoice_address": _("The e-invoice address must be 12–35 letters or digits."),
"e_invoice_operator_required": _("Enter the operator ID when an e-invoice address is given."),
"invalid_email": _("Enter a valid email address."),
"contact_not_found": _("The contact was not found."),
"billing_unit_not_found": _("The billing unit was not found."),
"contact_in_use": _("The contact cannot be deleted because a job refers to it."),
"billing_unit_in_use": _("The billing unit cannot be deleted because a job refers to it."),
"*": _("The change could not be saved."),
}