From 58ea3a10e841a99538589ca5096ce0b404f90d09 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 31 Jan 2023 14:20:53 +0100 Subject: [PATCH] Invert condition on can send invoice --- app/reflexes/bulk_actions_in_orders_list_reflex.rb | 2 +- spec/system/admin/orders_spec.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/reflexes/bulk_actions_in_orders_list_reflex.rb b/app/reflexes/bulk_actions_in_orders_list_reflex.rb index bc75f23c8e..b8b6f9c999 100644 --- a/app/reflexes/bulk_actions_in_orders_list_reflex.rb +++ b/app/reflexes/bulk_actions_in_orders_list_reflex.rb @@ -11,7 +11,7 @@ class BulkActionsInOrdersListReflex < ApplicationReflex def send_invoice(order_ids) orders(order_ids).find_each do |o| - Spree::OrderMailer.invoice_email(o.id).deliver_later unless o.distributor.can_invoice? + Spree::OrderMailer.invoice_email(o.id).deliver_later if o.distributor.can_invoice? end success("admin.send_invoice_feedback", order_ids.count) diff --git a/spec/system/admin/orders_spec.rb b/spec/system/admin/orders_spec.rb index 2e9b4453a6..055808098f 100644 --- a/spec/system/admin/orders_spec.rb +++ b/spec/system/admin/orders_spec.rb @@ -385,6 +385,9 @@ describe ' end it "can bulk send invoice for 2 orders" do + Spree::Config[:enable_invoices?] = true + Spree::Config[:enterprise_number_required_on_invoices?] = false + page.find("#listing_orders tbody tr:nth-child(1) input[name='order_ids[]']").click page.find("#listing_orders tbody tr:nth-child(2) input[name='order_ids[]']").click