diff --git a/app/models/voucher.rb b/app/models/voucher.rb index bb841e9555..9ba6a95c3b 100644 --- a/app/models/voucher.rb +++ b/app/models/voucher.rb @@ -13,9 +13,6 @@ class Voucher < ApplicationRecord dependent: :nullify validates :code, presence: true, uniqueness: { scope: :enterprise_id } - # We store the tax portion of a voucher in a separate adjustment with a label starting by "Tax" - # when tax are exluded from price. To avoid any issue we a code stating by Tax in not allowed - validates :code, format: { without: /\ATax/ } TYPES = ["Vouchers::FlatRate", "Vouchers::PercentageRate"].freeze diff --git a/config/locales/en.yml b/config/locales/en.yml index 3a62412ef2..efeaadafd3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -117,10 +117,6 @@ 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" - voucher: - attributes: - code: - invalid: "can't start with 'Tax'" messages: confirmation: "doesn't match %{attribute}" blank: "can't be blank" diff --git a/spec/models/voucher_spec.rb b/spec/models/voucher_spec.rb index da47d8905e..4e3c294af9 100644 --- a/spec/models/voucher_spec.rb +++ b/spec/models/voucher_spec.rb @@ -28,11 +28,6 @@ describe Voucher do it { is_expected.to validate_presence_of(:code) } it { is_expected.to validate_uniqueness_of(:code).scoped_to(:enterprise_id) } - it "doesn't accept code starting with 'Tax'" do - voucher = build(:voucher_flat_rate, code: 'Taxnew_code', enterprise: enterprise) - - expect(voucher.valid?).to be(false) - end end describe '#display_value' do