GL Entry data lost

Hi,
We found some GL Entry data lost during update from a quite old version 4 to version 6. I’ve migrated many times again for investigating, then I found the patch named repost_sle_for_si_with_no_warehouse.py caused the issue. (the data lost when adding this patch into patch list, the data not lost when removing this patch).
Is it possible this patch will delete GL Entry data in one step?
By the way, we lost some DN and STE data in GL Entry, but those DN and STE still there. And I checked their related sales invoice not in the fail repost list.

Thanks

@Jasmine thanks for reporting.

CC @nabinhait

Can you provide before and after gl entry data for an invoice for which it is lost?

There was a bug for which in invoice warehouse was missing even if update_stock was checked. That leads to wrong gl entries for those invoices. We had written that patch to fix those wrong gl entries.

And regarding DN and STE data, have you disabled perpetual inventory option?

@nabinhait Thanks your reply.
First we didn’t lost sales invoice data in GL Entry. All the lost data are DN and STE data in GL Entry.
For example, we got DN-00163 in Delivery Note and its GL Entry data before migration, but all of its GL entry data lost after migration, however, DN-00163 is still in Delivery Note table. So should I give you the DN data or related sales invoice data
By the way, we haven’t disabled perpetual inventory option.

We still found some outstanding_amount of sales invoice are not right after migration. Those outstanding_amount of sales invoice should be 0. They are fixed to 0 after I ran a patch calling the function update_outstanding_amt.

I’m just wondering if the data messes after migration is because we had a big jump migration from version 4.21 to version 6.7.

What are the steps you followed to migrate? Have you updated to latest version of 4 first and then switched to version 5?

@nabinhait We didn’t switched to version 5, we migrated from 4.21 to 6.7 directly, the main steps are:
cd ~/bench-repo
git pull
cd ~/frappe-bench
bench update --patch
bench update --upgrade --force

Looks correct. Then why “update_outstanding_amt” patch has not executed?

Do you mean ‘fix_invoice_oustanding.py’ patch, that’s in ‘tabPatch Log’, so should be executed.

It is really very difficult to say why some gl entries has been deleted. We have migrated so many accounts without any such issue.

@nabinhait Thank you very much, now we can only use patch to fix data.