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.55k stars 9.32k forks source link

Inconsistent payment_method field length in grid tables #37665

Open mjresurs opened 1 year ago

mjresurs commented 1 year ago

Preconditions and environment

On Magento 2.4.6 it appears that the column payment_method has inconsistent lengths in the different grid tables which results in the payment method not showing in the grid views in admin.

Table Length
sales_order_grid 255
sales_invoice_grid 128
sales_creditmemo_grid 32
sales_shipment_grid 32

Steps to reproduce

  1. Create or modify a payment method so that its code is longer than 32 characters.
  2. Place an order using that payment method
  3. Create an order shipment
  4. Show the Payment Method column in the shipment grid view

Expected result

The payment method name is displayed in the Payment Method column in the grid view.

Actual result

The Payment Method name column is blank.

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @mjresurs. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo, here is your Magento Instance: https://ef1e021ad17f870cd00eca7730517f22.instances-prod.magento-community.engineering Admin access: https://ef1e021ad17f870cd00eca7730517f22.instances-prod.magento-community.engineering/admin_b0b7 Login: 31b14b9d Password: 8ca5e99a1891

engcom-Bravo commented 1 year ago

Hi @mjresurs,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.

Steps to reproduce

The payment method name is displayed in the Payment Method column in the grid view after shipment.

Screenshot 2023-06-27 at 11 50 55 AM Screenshot 2023-06-27 at 11 52 26 AM

Kindly recheck the behaviour on Magento 2.4-develop instance and elaborate steps to reproduce if the issue is still reproducible.

Thanks.

mjresurs commented 1 year ago

@engcom-Bravo I'm not sure if there was some miscommunication here but it appears your screenshot shows payment methods with long names rather than a long code. The issue I've noticed on 2.4.6 is that you can have a payment method with a code like, as an example, custom_module_payment_method_code_that_is_quite_long (52 characters).

Now what happens when you create a credit memo or shipment is that Magento will store this as the truncated 32 character string custom_module_payment_method_cod in since that's the max length of the column payment_method is in both sales_creditmemo_grid and sales_shipment_grid.

So when you then try to view the credit memo or shipment grids it will fail to fetch the payment method information because there is no payment method with the code custom_module_payment_method_cod.

mjresurs commented 1 year ago

E.g. for the table sales_shipment_grid in /app/code/Magento/Sales/etc/db_schema.xml#L786:

<column xsi:type="varchar" name="payment_method" nullable="true" length="32" comment="Payment Method"/>

m2-assistant[bot] commented 1 year ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 1 year ago

Hello @mjresurs,

Thanks for the report & collaboration!

We have tried to reproduce the issue in Magento 2.4-develop branch by looking into the codebase. And it seems the issue is valid.

When we are creating a shipment and if the code exceeds the limit i.e. 32, then the code will either be truncated or empty. Hence confirming the issue.

Thanks

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9114 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.