Copy Invoice line fails (duplicate key) because c_invoiceline_uu is also copied.

Description

I think the below trace describes the problem quite well I'm using a hg-repo (idempiere) that's about 2 weeks old.

===========> DB.executeUpdate: INSERT INTO C_InvoiceLine (C_Invoice_ID,PriceActual,AD_Org_ID,C_Tax_ID,Line,QtyInvoiced,LineTotalAmt,PriceEntered,PriceList,IsPrinted,QtyEntered,M_AttributeSetInstance_ID,PriceLimit,A_CreateAsset,Processed,RRAmt,C_Charge_ID,UpdatedBy,TaxAmt,CreatedBy,Updated,AD_Client_ID,IsActive,Created,C_InvoiceLine_UU,LineNetAmt,C_UOM_ID,C_InvoiceLine_ID,A_Processed,IsDescription) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) [SvrProcess_2f27d987-4c2a-4c78-9177-48b5690b3c28] [12]
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "c_invoiceline_uu_idx"
Detail: Key (c_invoiceline_uu)=(6b3c4409-8448-43a8-9397-ec35d901c455) already exists.; State=23505; ErrorCode=0
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.compiere.db.StatementProxy.invoke(StatementProxy.java:125)
at $Proxy0.executeUpdate(Unknown Source)
at org.compiere.util.DB.executeUpdate(DB.java:1027)
at org.compiere.util.DB.executeUpdate(DB.java:992)
at org.compiere.model.PO.doInsert(PO.java:2892)
at org.compiere.model.PO.saveNew(PO.java:2696)
at org.compiere.model.PO.save(PO.java:2065)
at org.compiere.model.PO.save(PO.java:2252)
at org.compiere.model.MInvoice.copyLinesFrom(MInvoice.java:758)
at org.compiere.process.CopyFromInvoice.doIt(CopyFromInvoice.java:68)
at org.compiere.process.SvrProcess.process(SvrProcess.java:163)
at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:116)

Environment

None

Activity

Show:
Daniel Tamm
July 3, 2012, 8:27 PM

Verified that problem also exists in latest tip (development).

Carlos Ruiz
July 4, 2012, 1:16 AM

Daniel, I think your C_InvoiceLine_UU column have set the IsAllowCopy to Yes and that's wrong.

Can you check? The seed database doesn't have that problem, so we must check where was introduced.

Regards,

Carlos Ruiz

Daniel Tamm
July 4, 2012, 2:23 PM

Yes, you were right. Unchecking the IsAllowCopy solved the problem. This is a migration database so either I missed a script or the migration path doesn't include unchecking IsAllowCopy where it's needed. The particular database has had scripts up to 837_IDEMPIERE-195.sql applied.

Regards
Daniel T

Assignee

Unassigned

Reporter

Daniel Tamm

Labels

Tested By

None

Time tracking

2h

Components

Affects versions

Due date

2012/08/31

Priority

Minor
Configure