kittiu / thai_tax

Thai Tax for ERPNext
Other
6 stars 3 forks source link

Duplication of Sales Tax Invoice #18

Open darkmanst opened 2 weeks ago

darkmanst commented 2 weeks ago

First, thank you for such a wonderful package, It greatly helps us.

I did run into an issue, somehow sales tax invoice have a duplicate and it is created by an administrator account (assume the system create it)

image

Please Point me out how to find an issue about this.

kittiu commented 6 days ago

Sorry I just see this message. Can you explain steps to this problem in more detail? How can I replicate it.

Are you Thai by the way?

darkmanst commented 6 days ago

Yes, I'm Thai. I think I've found out why it happened but I don't know how to fix it.

This occur when I post back-date sales transaction for stock item. (Using FIFO and perpetual inventory, Update Stock is checked so that Stock Transaction will occur on Sale Invoice rather than Delivery Note). ERPNext has a scheduled task called "repost_item_valuation.repost_entries" It creates a Doctype "Repost Item Valuation" and New GL Entry Automatically.

When a new GL Entry is created old GL Entry is gone. Somehow Sales Tax Invoices get created, hence the duplication.

kittiu commented 2 days ago

What I can say is the Sales and Purchase Tax Invoices is created when the related GL Entry to tax is created (and deleted when it is deleted but normall it will be reverted not deleted). Number skipping is not a good thing, I have to think of ways to avoid it, may be to keep it somewhere and reuse it. So, I guess, the GL Entry is deleted when you repost the item. I will check. About the duplication, I am not sure why.

Thanks for reporting case, I will check.