Typing "0" into Betalningsvillkor on a customer made the form silently unsavable: the form schema had min(1) and no error was rendered for the field, so the user saw nothing happen. 0 days is a real value (betalning direkt / vid mottagande), and the invoice schema already accepted it. Customer and supplier forms now validate whole days 0-365 and show the rule under the field; the API schemas (customer create/update, supplier) accept 0 the same way; and every `|| 30` fallback that would have turned a stored 0 back into 30 on edit or create is `?? 30`. Closes #2070 Claude-Session: https://claude.ai/code/session_01VnConrmMCxJRQ5kfiPPWyy Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Jakob Wennberg
Claude Fable 5.1
parent
5eac2a492c
commit
1150930cb9
@@ -70,7 +70,8 @@ export const POST = withRouteContext(
|
||||
clearing_number: body.clearing_number,
|
||||
account_number: body.account_number,
|
||||
default_expense_account: body.default_expense_account,
|
||||
default_payment_terms: body.default_payment_terms || 30,
|
||||
// ?? not ||: 0 days (betalning direkt) is a value, not a missing one (#2070).
|
||||
default_payment_terms: body.default_payment_terms ?? 30,
|
||||
default_currency: body.default_currency || 'SEK',
|
||||
notes: body.notes,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user