Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accounting FactLine updateReverseLine SQLException for InventoryMove #416

Closed
bpali opened this issue Jun 6, 2016 · 2 comments
Closed

Accounting FactLine updateReverseLine SQLException for InventoryMove #416

bpali opened this issue Jun 6, 2016 · 2 comments

Comments

@bpali
Copy link

bpali commented Jun 6, 2016

Say you have a completed and posted Inventory Move document.

If you void it and try to post the reversed document it will fail with "Posting Error (Original Inventory Move not posted yet)"

This happens to any reversed Inventory Move document because of the following SQL Exception

===========> FactLine.updateReverseLine: SELECT * FROM Fact_Acct WHERE C_AcctSchema_ID=? AND AD_Table_ID=? AND Record_ID=? AND Line_ID=? AND Account_ID=? AND Qty=? AND M_Locator_ID=? [17]
org.postgresql.util.PSQLException: No value specified for parameter 7.; State=22023; ErrorCode=0
    at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:223)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:244)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:304)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.compiere.db.StatementProxy.invoke(StatementProxy.java:100)
    at com.sun.proxy.$Proxy0.executeQuery(Unknown Source)
    at org.compiere.acct.FactLine.updateReverseLine(FactLine.java:1079)
    at org.compiere.acct.Doc_Movement.createFacts(Doc_Movement.java:167)
    at org.compiere.acct.Doc.postLogic(Doc.java:759)
    at org.compiere.acct.Doc.post(Doc.java:643)
    at org.compiere.acct.Doc.postImmediate(Doc.java:351)
    at org.compiere.session.ServerBean.postImmediate(ServerBean.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)

The SQL Exception strikes beause parameter 7 was not set.

Inside method org.compiere.acct.FactLine.updateReverseLine parameter set expressions

pstmt.setInt(5, m_acct.getAccount_ID());
pstmt.setBigDecimal(6, quantity.negate());
// MZ Goodwill
// for Inventory Move
if (MMovement.Table_ID == AD_Table_ID)
    pstmt.setInt(6, getM_Locator_ID());
// end MZ

should be like this

pstmt.setInt(5, m_acct.getAccount_ID());
pstmt.setBigDecimal(6, quantity.negate());
// MZ Goodwill
// for Inventory Move
if (MMovement.Table_ID == AD_Table_ID)
    pstmt.setInt(7, getM_Locator_ID());
// end MZ

This bug was introduced in the following changeset
Commit: 09a0aa2 [09a0aa2]
Parents: ebe2eb9
Author: eEvolution author Victor Perez victor.perez@e-evolution.com
Date: Saturday, 08 November, 2014 9:26:30 PM
Solve issue with revert document, now to find of original fact act is necessary quantity transaction

when this line was modified + " AND Line_ID=? AND Account_ID=? AND Qty=?";
and this line added pstmt.setBigDecimal(6, quantity.negate());

bpali pushed a commit to bpali/adempiere that referenced this issue Jun 6, 2016
e-Evolution added a commit that referenced this issue Jun 6, 2016
#416 Bugfix Accounting FactLine updateReverseLine SQLException for InventoryMove
@bpali
Copy link
Author

bpali commented Jun 7, 2016

Bugfix pull request was merged.

Issue solved

@bpali bpali closed this as completed Jun 7, 2016
@marcalwestf
Copy link
Collaborator

thanks Bogdan. weĺl test it.

e-Evolution pushed a commit that referenced this issue Aug 5, 2016
e-Evolution added a commit that referenced this issue Aug 5, 2016
#416 Bugfix Accounting FactLine updateReverseLine SQLException for InventoryMove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants