magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.49k stars 9.31k forks source link

"We can not created empty shipment" during creation of the Shipment and Invoice for payment which does not support partial capture. #27042

Closed ant-workaholic closed 4 years ago

ant-workaholic commented 4 years ago

Preconditions (*)

  1. Use Payment method with 0 option. The payment method should not have an ability to perform partial capture.
  2. Specify payment action as (authorize).
  3. Place order with the payment.

Steps to reproduce (*)

  1. Navigate to Sales -> Operations -> Orders and choose the placed order.
  2. Click on "Invoice" link.
  3. On the "New Invoice" page, under shipping information choose "Create Shipment" by clicking on checkbox.

shipment

  1. Then click "Submit Invoice"

Expected result (*)

  1. Page reloaded with success message.
  2. Invoice and shipment created.

Actual result (*)

  1. Page reloaded with error message message.

shipment_error

I found that the main reason of the issue is that in the template

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items/renderer/default.phtml#L21 in the else statement input element was replaced with just value and the data doesn't trasfer to the controller.

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php#L102

I propose to add a hidden field to the template https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items/renderer/default.phtml#L21

<input type="hidden" name="invoice[items][<?= (int) $_item->getOrderItemId() ?>]" value="<?= (int) $_item->getQty() ?>"/>

The issue reproducable for Community and Commerce Edition.

m2-assistant[bot] commented 4 years ago

Hi @ant-workaholic. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@ant-workaholic do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


vincentle89 commented 4 years ago

Hi @ant-workaholic I can't reproduce your issue on Magento ver 2.4-develop. Maybe it was fixed. Please take a look at my record:https://youtu.be/XDpEMKykomk

ant-workaholic commented 4 years ago

Hi @ant-workaholic I can't reproduce your issue on Magento ver 2.4-develop. Maybe it was fixed. Please take a look at my record:https://youtu.be/XDpEMKykomk

Could you make sure that shipment exists ? I did not see this in your video, just success message. Please verify also for guest user. For real customer I got the same success message but my shipment wasn't created, but for not logged in user I got the error. I tested on magento 2.3 on my custom payment but I am pretty sure that this is a Magento issue. I've debugged this, I described the reason of the issue in description. Thank you.

ant-workaholic commented 4 years ago

@vincent-le89 Yes, it seems it was fixed in 2.4-develop but not in "2.3.3". So, yes, the issue could be closed.