If there are >thousands/100k of documents and accounting records the reset accounting process takes a _very_ long time to run. It can take many many hours (I ran it for more than 8 hours without completing).
What needs to be done to correct this is to add an index to fact_acct on columns Record_ID and AD_Table_ID (strange it hasn't been done yet).
I also propose adding indexes on c_bpartner_id and m_product_id.'
I suggest adding the following indexes where the last one solves this issue.:
-- Index: fact_acct_bpartner
-- DROP INDEX fact_acct_bpartner;
CREATE INDEX fact_acct_bpartner
-- Index: fact_acct_product
-- DROP INDEX fact_acct_product;
CREATE INDEX fact_acct_product
-- Index: fact_acct_record
-- DROP INDEX fact_acct_record;
CREATE INDEX fact_acct_record