diff --git a/app/models/enterprise_fee.rb b/app/models/enterprise_fee.rb index bac889327b..9acfc31134 100644 --- a/app/models/enterprise_fee.rb +++ b/app/models/enterprise_fee.rb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index c8a9ab96fc..e991f46884 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: