Adapt reports controller to handle routes of reports in the order_management engine differently

This commit is contained in:
Luis Ramos
2020-03-18 12:11:27 +00:00
parent 3f5a964dec
commit 9994bc75ca

View File

@@ -298,11 +298,20 @@ module Spree
end
def url_for_report(report)
public_send("#{report}_admin_reports_url".to_sym)
if report_in_order_management_engine?(report)
main_app.public_send("new_order_management_reports_#{report}_url".to_sym)
else
public_send("#{report}_admin_reports_url".to_sym)
end
rescue NoMethodError
url_for([:new, :admin, :reports, report.to_s.singularize])
end
# List of reports that have been moved to the Order Management engine
def report_in_order_management_engine?(report)
report == :enterprise_fee_summary
end
def timestamp
Time.zone.now.strftime("%Y%m%d")
end