Skip to content

New Invoice: Checkbox "Email Copy of Invoice" is useless #28511

Closed
@TerrapinSoftware

Description

@TerrapinSoftware

Preconditions (*)

  1. 2.3.5-p1
  2. Magento 2.4-develop

Steps to reproduce (*)

  1. Go to Admin -> Stores -> Configuration -> Sales -> Sales Emails -> Invoice:
    set Enable to Yes;
    set Send Invoice Email Copy To to [email protected]
  2. Create Order;
  3. Go to Admin -> Sales -> Orders and open created before order for edit;
  4. Click on the Invoice button;
  5. Uncheck "Email Copy of Invoice";
  6. Generate Invoice;

Expected result (*)

  1. Email should not be sent to anyone

Actual result (*)

  1. Email sent both to Customer and Copy To

The behavior changed from M1 to M2. Regardless if you check that checkbox or not, the email is sent to both the customer and the Copy To address. If you disable the sending of invoices in the Config section, there is no way to send invoice emails at all, because the "Send Email" button in the View Invoice screen does nothing, and the checkbox is not displayed in the New Invoice section.

Looking at the source code, I find this in vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Save.php, line 216:

if (!empty($data['send_email']) || $this->salesData->canSendNewInvoiceEmail()) {
    $this->invoiceSender->send($invoice);

Looks good so far; if the config is "off", the checkbox would override the setting.

Unfortunately, the checkbox is not displayed at all when the config is "off".

Even if the checkbox would be visible, emails would not be sent, because in the file vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php at line 101, I find this:

public function send(Invoice $invoice, $forceSyncMode = false)
{
    $invoice->setSendEmail($this->identityContainer->isEnabled());

This picks up the "off" value from the config, thus overriding any checkbox value again.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [*] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: EmailComponent: SalesFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: ready for confirmationPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.3.5-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions