mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Display default xero invoice dates
fixes #682 * pre-fill the invoice_date and due_date in the xero report generation form * increase the default period between invoice_date and due_date to 1 month in XeroInvoiceReport
This commit is contained in:
@@ -244,7 +244,9 @@ Spree::Admin::ReportsController.class_eval do
|
||||
def xero_invoices
|
||||
if request.get?
|
||||
params[:q] ||= {}
|
||||
params[:q][:completed_at_gt] = Time.zone.now.beginning_of_month
|
||||
params[:q][:completed_at_gt] = Time.zone.today.beginning_of_month
|
||||
params[:invoice_date] = Time.zone.today
|
||||
params[:due_date] = Time.zone.today + 1.month
|
||||
end
|
||||
@distributors = Enterprise.is_distributor.managed_by(spree_current_user)
|
||||
@order_cycles = OrderCycle.active_or_complete.accessible_by(spree_current_user).order('orders_close_at DESC')
|
||||
|
||||
@@ -6,8 +6,8 @@ module OpenFoodNetwork
|
||||
@opts = opts.
|
||||
reject { |k, v| v.blank? }.
|
||||
reverse_merge({report_type: 'summary',
|
||||
invoice_date: Date.today,
|
||||
due_date: 2.weeks.from_now.to_date,
|
||||
invoice_date: Time.zone.today,
|
||||
due_date: Time.zone.today + 1.month,
|
||||
account_code: 'food sales'})
|
||||
end
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ module OpenFoodNetwork
|
||||
|
||||
it "uses defaults when blank params are passed" do
|
||||
report.instance_variable_get(:@opts).should == {invoice_date: Date.civil(2015, 5, 5),
|
||||
due_date: Date.civil(2015, 5, 19),
|
||||
due_date: Date.civil(2015, 6, 5),
|
||||
account_code: 'food sales',
|
||||
report_type: 'summary'}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user