Skip to content

Commit c2244f1

Browse files
Org: Round invoice to 0.05 before grand total.
TYPE: Feature LINK: OGC-2957
1 parent 2794281 commit c2244f1

24 files changed

Lines changed: 656 additions & 121 deletions

File tree

src/onegov/org/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'form': _('Selected Options'),
2424
'manual': _('Discounts / Surcharges'),
2525
'migration': _('Lump sum'),
26+
'rounding': _('Rounding difference'),
2627
}
2728

2829
PAYMENT_STATES: dict[PaymentState, str] = {

src/onegov/org/forms/settings.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from operator import itemgetter
4646
from purl import URL
4747
from wtforms.fields import BooleanField
48+
from wtforms.fields import DecimalField
4849
from wtforms.fields import EmailField
4950
from wtforms.fields import FieldList
5051
from wtforms.fields import FloatField
@@ -2470,6 +2471,16 @@ class VATSettingsForm(Form):
24702471
validators=[InputRequired(), NumberRange(0, 100)],
24712472
)
24722473

2474+
price_rounding = DecimalField(
2475+
label=_('Rounding of invoice totals'),
2476+
description=_(
2477+
'If set, invoices include a rounding position so the total is '
2478+
'a multiple of this amount, for example 0.05. Leave empty to '
2479+
'disable rounding.'
2480+
),
2481+
validators=[Optional(), NumberRange(min=Decimal('0.01'))],
2482+
)
2483+
24732484

24742485
class ModuleActivationSettingsForm(Form):
24752486
show_newsletter = BooleanField(

src/onegov/org/locale/de_CH/LC_MESSAGES/onegov.org.po

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
msgid ""
33
msgstr ""
44
"Project-Id-Version: PACKAGE 1.0\n"
5-
"POT-Creation-Date: 2026-07-14 12:32+0200\n"
5+
"POT-Creation-Date: 2026-07-16 15:23+0200\n"
66
"PO-Revision-Date: 2022-03-15 10:21+0100\n"
77
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n"
88
"Language-Team: German\n"
@@ -186,6 +186,9 @@ msgstr "Abzüge / Zuschläge"
186186
msgid "Lump sum"
187187
msgstr "Pauschalbetrag"
188188

189+
msgid "Rounding difference"
190+
msgstr "Rundungsdifferenz"
191+
189192
msgid "Paid"
190193
msgstr "Bezahlt"
191194

@@ -3123,6 +3126,17 @@ msgstr ""
31233126
"Mehrwertsteuersatz in Prozent. Der Mehrwertsteuersatz wird auf alle Preise "
31243127
"in den Formularen angewendet."
31253128

3129+
msgid "Rounding of invoice totals"
3130+
msgstr "Rundung der Rechnungssummen"
3131+
3132+
msgid ""
3133+
"If set, invoices include a rounding position so the total is a multiple of "
3134+
"this amount, for example 0.05. Leave empty to disable rounding."
3135+
msgstr ""
3136+
"Wenn festgelegt, enthalten Rechnungen eine Rundungsposition, sodass die "
3137+
"Summe ein Vielfaches dieses Betrags ist, zum Beispiel 0.05. Leer lassen, um "
3138+
"die Rundung zu deaktivieren."
3139+
31263140
msgid "Enable newsletter"
31273141
msgstr "Newsletter aktivieren"
31283142

@@ -4508,8 +4522,8 @@ msgstr "Anzahl"
45084522
msgid "VAT"
45094523
msgstr "MwSt"
45104524

4511-
#. credit card
45124525
#.
4526+
#. credit card
45134527
msgid "Payment"
45144528
msgstr "Zahlung"
45154529

@@ -4886,9 +4900,6 @@ msgstr "Fehler"
48864900
msgid "Duration [s]"
48874901
msgstr "Abfragedauer [s]"
48884902

4889-
msgid "Alternatives"
4890-
msgstr "Alternativen"
4891-
48924903
msgid "Alternative login methods"
48934904
msgstr "Alternative Login-Methoden"
48944905

@@ -4904,6 +4915,9 @@ msgstr "Sie haben Ihr Passwort vergessen?"
49044915
msgid "Reset password"
49054916
msgstr "Passwort zurücksetzen"
49064917

4918+
msgid "Alternatives"
4919+
msgstr "Alternativen"
4920+
49074921
msgid "You are here"
49084922
msgstr "Sie sind hier"
49094923

@@ -5372,8 +5386,8 @@ msgstr ""
53725386
msgid "New customer message in Ticket ${link}"
53735387
msgstr "Neue Kunden Nachricht in Ticket ${link}"
53745388

5375-
#. Canonical text for ${link} is: "visit the request page"
53765389
#. Canonical text for ${link} is: "visit the request status page"
5390+
#. Canonical text for ${link} is: "visit the request page"
53775391
msgid "Please ${link} to reply."
53785392
msgstr "Bitte ${link} um zu antworten"
53795393

@@ -6603,8 +6617,8 @@ msgid "Delete availability period"
66036617
msgstr "Verfügbarkeitszeitraum löschen"
66046618

66056619
#.
6606-
#. type:ignore[attr-defined]
66076620
#. type:ignore[attr-defined] # trigger updates
6621+
#. type:ignore[attr-defined]
66086622
msgid "Your changes were saved"
66096623
msgstr "Ihre Änderungen wurden gespeichert"
66106624

@@ -7953,6 +7967,9 @@ msgstr "Kopfzeile"
79537967
msgid "Footer"
79547968
msgstr "Fusszeile"
79557969

7970+
msgid "Prices"
7971+
msgstr "Preise"
7972+
79567973
msgid "Data Retention Policy"
79577974
msgstr "Datensparsamkeit"
79587975

src/onegov/org/locale/fr_CH/LC_MESSAGES/onegov.org.po

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
msgid ""
33
msgstr ""
44
"Project-Id-Version: PACKAGE 1.0\n"
5-
"POT-Creation-Date: 2026-07-14 12:32+0200\n"
5+
"POT-Creation-Date: 2026-07-16 15:23+0200\n"
66
"PO-Revision-Date: 2022-03-15 10:50+0100\n"
77
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n"
88
"Language-Team: French\n"
@@ -185,6 +185,9 @@ msgstr "Remises / Suppléments"
185185
msgid "Lump sum"
186186
msgstr "Montant forfaitaire"
187187

188+
msgid "Rounding difference"
189+
msgstr "Différence d'arrondi"
190+
188191
msgid "Paid"
189192
msgstr "Payé"
190193

@@ -3135,6 +3138,17 @@ msgstr ""
31353138
"Il s'agit du taux de TVA en pourcentage. Le taux de TVA s'appliquera à tous "
31363139
"les prix dans les formulaires."
31373140

3141+
msgid "Rounding of invoice totals"
3142+
msgstr "Arrondi des totaux de facture"
3143+
3144+
msgid ""
3145+
"If set, invoices include a rounding position so the total is a multiple of "
3146+
"this amount, for example 0.05. Leave empty to disable rounding."
3147+
msgstr ""
3148+
"Si ce champ est défini, les factures contiennent une position d’arrondi afin "
3149+
"que le total soit un multiple de ce montant, par exemple 0,05. Laisser vide "
3150+
"pour désactiver l’arrondi."
3151+
31383152
msgid "Enable newsletter"
31393153
msgstr "Activer la newsletter"
31403154

@@ -4513,8 +4527,8 @@ msgstr "Quantité"
45134527
msgid "VAT"
45144528
msgstr "TVA"
45154529

4516-
#. credit card
45174530
#.
4531+
#. credit card
45184532
msgid "Payment"
45194533
msgstr "Paiement"
45204534

@@ -4895,9 +4909,6 @@ msgstr "Erreurs"
48954909
msgid "Duration [s]"
48964910
msgstr "Durée [s]"
48974911

4898-
msgid "Alternatives"
4899-
msgstr "Alternatives"
4900-
49014912
msgid "Alternative login methods"
49024913
msgstr "Méthodes de connexion alternatives"
49034914

@@ -4913,6 +4924,9 @@ msgstr "Avez-vous oublié votre mot de passe ?"
49134924
msgid "Reset password"
49144925
msgstr "Réinitialisez le mot de passe"
49154926

4927+
msgid "Alternatives"
4928+
msgstr "Alternatives"
4929+
49164930
msgid "You are here"
49174931
msgstr "Vous êtes ici"
49184932

@@ -5377,8 +5391,8 @@ msgstr ""
53775391
msgid "New customer message in Ticket ${link}"
53785392
msgstr "Nouveau message du client dans le ticket ${link}"
53795393

5380-
#. Canonical text for ${link} is: "visit the request page"
53815394
#. Canonical text for ${link} is: "visit the request status page"
5395+
#. Canonical text for ${link} is: "visit the request page"
53825396
msgid "Please ${link} to reply."
53835397
msgstr "Veuillez vous rendre sur ${link} pour répondre."
53845398

@@ -6615,8 +6629,8 @@ msgid "Delete availability period"
66156629
msgstr "Supprimer la période de disponibilité"
66166630

66176631
#.
6618-
#. type:ignore[attr-defined]
66196632
#. type:ignore[attr-defined] # trigger updates
6633+
#. type:ignore[attr-defined]
66206634
msgid "Your changes were saved"
66216635
msgstr "Vos modifications ont été enregistrées"
66226636

@@ -7961,6 +7975,9 @@ msgstr "En-tête"
79617975
msgid "Footer"
79627976
msgstr "Bas de page"
79637977

7978+
msgid "Prices"
7979+
msgstr "Prix"
7980+
79647981
msgid "Data Retention Policy"
79657982
msgstr "Politique de Conservation des Données"
79667983

src/onegov/org/locale/it_CH/LC_MESSAGES/onegov.org.po

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
msgid ""
33
msgstr ""
44
"Project-Id-Version: \n"
5-
"POT-Creation-Date: 2026-07-14 12:32+0200\n"
5+
"POT-Creation-Date: 2026-07-16 15:23+0200\n"
66
"PO-Revision-Date: 2022-03-15 10:52+0100\n"
77
"Last-Translator: \n"
88
"Language-Team: \n"
@@ -187,6 +187,9 @@ msgstr "Deduzioni / Supplementi"
187187
msgid "Lump sum"
188188
msgstr "Somma forfettaria"
189189

190+
msgid "Rounding difference"
191+
msgstr "Differenza di arrotondamento"
192+
190193
msgid "Paid"
191194
msgstr "Pagato"
192195

@@ -3132,6 +3135,17 @@ msgstr ""
31323135
"Si tratta del tasso di IVA in percentuale. Il tasso di IVA si applicherà a "
31333136
"tutti i prezzi nei moduli."
31343137

3138+
msgid "Rounding of invoice totals"
3139+
msgstr "Arrotondamento dei totali delle fatture"
3140+
3141+
msgid ""
3142+
"If set, invoices include a rounding position so the total is a multiple of "
3143+
"this amount, for example 0.05. Leave empty to disable rounding."
3144+
msgstr ""
3145+
"Se impostato, le fatture includono una posizione di arrotondamento in modo "
3146+
"che il totale sia un multiplo di questo importo, ad esempio 0,05. Lasciare "
3147+
"vuoto per disattivare l’arrotondamento."
3148+
31353149
# ", assicurarsi di racchiudere il valore tra virgolette."
31363150
msgid "Enable newsletter"
31373151
msgstr "Attiva la newsletter"
@@ -4502,8 +4516,8 @@ msgstr "Quantità"
45024516
msgid "VAT"
45034517
msgstr "IVA"
45044518

4505-
#. credit card
45064519
#.
4520+
#. credit card
45074521
msgid "Payment"
45084522
msgstr "Pagamento"
45094523

@@ -4878,9 +4892,6 @@ msgstr "Errori"
48784892
msgid "Duration [s]"
48794893
msgstr "Durata [s]"
48804894

4881-
msgid "Alternatives"
4882-
msgstr "Alternative"
4883-
48844895
msgid "Alternative login methods"
48854896
msgstr "Metodi di accesso alternativi"
48864897

@@ -4896,6 +4907,9 @@ msgstr "Hai dimenticato la password?"
48964907
msgid "Reset password"
48974908
msgstr "Reimposta la password"
48984909

4910+
msgid "Alternatives"
4911+
msgstr "Alternative"
4912+
48994913
msgid "You are here"
49004914
msgstr "Ti trovi qui"
49014915

@@ -5355,8 +5369,8 @@ msgstr ""
53555369
msgid "New customer message in Ticket ${link}"
53565370
msgstr "Nuovo messaggio del cliente nel ticket ${link}"
53575371

5358-
#. Canonical text for ${link} is: "visit the request page"
53595372
#. Canonical text for ${link} is: "visit the request status page"
5373+
#. Canonical text for ${link} is: "visit the request page"
53605374
msgid "Please ${link} to reply."
53615375
msgstr "Per favore ${link} per rispondere."
53625376

@@ -6589,8 +6603,8 @@ msgid "Delete availability period"
65896603
msgstr "Elimina il periodo di disponibilità"
65906604

65916605
#.
6592-
#. type:ignore[attr-defined]
65936606
#. type:ignore[attr-defined] # trigger updates
6607+
#. type:ignore[attr-defined]
65946608
msgid "Your changes were saved"
65956609
msgstr "Le modifiche sono state salvate"
65966610

@@ -7923,6 +7937,9 @@ msgstr "Intestazione"
79237937
msgid "Footer"
79247938
msgstr "Piè di pagina"
79257939

7940+
msgid "Prices"
7941+
msgstr "Prezzi"
7942+
79267943
msgid "Data Retention Policy"
79277944
msgstr "Politica di Conservazione dei Dati"
79287945

src/onegov/org/models/organisation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
if TYPE_CHECKING:
2525
from collections.abc import Iterator
2626
from datetime import datetime
27+
from decimal import Decimal
2728
from markupsafe import Markup
2829
from onegov.core.framework import Framework
2930
from onegov.form.parser.core import ParsedField
@@ -326,6 +327,9 @@ def get_kaba_configuration(
326327
# vat
327328
vat_rate: dict_property[float | None] = meta_property(default=0.0)
328329

330+
# prices
331+
price_rounding: dict_property[Decimal | None] = meta_property(default=None)
332+
329333
# RIS settings
330334
ris_enabled: dict_property[bool] = meta_property(default=False)
331335
ris_main_url: dict_property[str | None] = meta_property(default=None)

0 commit comments

Comments
 (0)