Home > Software design >  Getting issue on exporting credit memo for selected one from admin grid
Getting issue on exporting credit memo for selected one from admin grid

Time:10-18

I am getting issue on exporting the selected credit memo grid. It is only occurring with the credit memo. Other export is working fine with shipment, invoice, and order.

I am also attaching the error screenshot. credit memo

CodePudding user response:

You have an SQL query error while exporting the Credit memo data, it happens whenever you something deleted a record in your database.

Can you please elaborate on more steps:

-Did you delete some orders associated with the credit memo?
-Did you delete some invoices of any order?

Please check and confirm also check the record with entity_id = 1052 in your database table. Run the below query:

Select * from sales_creditmemo_grid where entity_id = 1052
Select * from sales_creditmemo_grid where entity_id = 1179
Select * from sales_creditmemo where entity_id = 1179
Select * from sales_creditmemo where entity_id = 1052

CodePudding user response:

Maybe another way to fix this is if you have added a third-party module that has its own Credit memo Grid within the module to show placed credit memo of each order. This is also conflicting because it is using entity_id from sales_creditmemo_grid as well.

Error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguous.

So, you can try in your credit memo collection file and change the method like:

Replaced this:

->addFieldToFilter('entity_id', ['in', $creditmemoIds]);

With this:

->addFieldToFilter('main_table.entity_id', ['in' => $creditmemoIds]);

Now all is well! No conflicts!

  • Related