feat(entries): Add amount validation and robustify monetizable concern (#1680)

* feat(entries): Add amount validation and robustify monetizable concern

* fix(valuations): localize blank amount errors

---------

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
Co-authored-by: SureBot <sure-bot@we-promise.com>
This commit is contained in:
sentry[bot]
2026-05-05 20:07:40 +02:00
committed by GitHub
parent 41339b0494
commit ec4559ba26
4 changed files with 43 additions and 1 deletions

View File

@@ -7,6 +7,12 @@ class ValuationsController < ApplicationController
@entry = @account.entries.build(entry_params.merge(currency: @account.currency))
if entry_params[:amount].blank?
@error_message = t("valuations.errors.amount_required")
render :new, status: :unprocessable_entity
return
end
@reconciliation_dry_run = @entry.account.create_reconciliation(
balance: entry_params[:amount],
date: entry_params[:date],
@@ -21,6 +27,13 @@ class ValuationsController < ApplicationController
return unless require_account_permission!(@entry.account)
@account = @entry.account
if entry_params[:amount].blank?
@error_message = t("valuations.errors.amount_required")
render :show, status: :unprocessable_entity
return
end
@entry.assign_attributes(entry_params.merge(currency: @account.currency))
@reconciliation_dry_run = @entry.account.update_reconciliation(