mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Bring TaxRate.match to OFN
The version of this method in spree 2.1 will break our build This way we simply bypass this fix in spree: https://github.com/spree/spree/pull/3669 We can get back to this in the future if we ever experience the mentioned bug
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
module Spree
|
||||
TaxRate.class_eval do
|
||||
class << self
|
||||
def match(order)
|
||||
return [] unless order.tax_zone
|
||||
all.select do |rate|
|
||||
rate.zone == order.tax_zone || rate.zone.contains?(order.tax_zone) || rate.zone.default_tax
|
||||
end
|
||||
end
|
||||
|
||||
def match_with_sales_tax_registration(order)
|
||||
return [] if order.distributor && !order.distributor.charges_sales_tax
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require 'spec_helper'
|
||||
|
||||
module Spree
|
||||
describe TaxRate do
|
||||
describe "selecting tax rates to apply to an order" do
|
||||
|
||||
Reference in New Issue
Block a user