mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
prevent saving the enterprise fee when a per order calculator is selected along with 'Inherit from product'
This commit is contained in:
@@ -58,6 +58,14 @@ class EnterpriseFee < ApplicationRecord
|
||||
elsif inherits_tax_category_changed?
|
||||
self.tax_category_id = nil if inherits_tax_category?
|
||||
end
|
||||
|
||||
if inherits_tax_category? && PER_ORDER_CALCULATORS.include?(calculator_type)
|
||||
errors.add(:inherits_tax_category,
|
||||
I18n.t("activerecord.errors.models." \
|
||||
"enterpise_fee.cannot_inherit_from_product_when_per_order_calculator_selected"))
|
||||
throw :abort
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,7 +113,8 @@ en:
|
||||
using_producer_stock_settings_but_count_on_hand_set: "must be blank because using producer stock settings"
|
||||
on_demand_but_count_on_hand_set: "must be blank if on demand"
|
||||
limited_stock_but_no_count_on_hand: "must be specified because forcing limited stock"
|
||||
|
||||
enterpise_fee:
|
||||
cannot_inherit_from_product_when_per_order_calculator_selected: "You cannot select 'Inherit From Product' when a per order calculator is selected"
|
||||
# Used by active_storage_validations
|
||||
errors:
|
||||
messages:
|
||||
|
||||
Reference in New Issue
Block a user