[ 
https://issues.apache.org/jira/browse/OFBIZ-5345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Carlow updated OFBIZ-5345:
------------------------------------

    Attachment: InvoiceServices.xml.patch

This patch resolves the InvoiceRole primary key violation error that was 
previously mentioned.  It also solves the InvoiceContactMech primary key 
violation error that results after the previous error is fixed.  

After both of these errors are fixed, an InvoiceItem primary key violation 
error occurs as a result of createInvoiceItem being called from 
createInvoiceForOrder of InvoiceServices.java.  

createInvoiceForOrder initializes inventoryItemSeqId to 1 when it is called 
which causes the primary key violation error when there is more than one 
orderId.

To resolve this, the inventoryItemSeqId would have to be tracked for different 
orderId when creating an invoice for orders.

> Cannot pick or pack shipment for mutiple sales orders
> -----------------------------------------------------
>
>                 Key: OFBIZ-5345
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5345
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Release Branch 12.04
>            Reporter: Christian Carlow
>         Attachments: InvoiceServices.xml.patch
>
>
> I get this error when trying to change the statusId of a shipment to picked 
> or packed:
> Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service 
> invocation error (Could not commit transaction for service [updateShipment] 
> call: Roll back error, could not commit transaction, was rolled back instead 
> because of: Failure in create operation for entity [InvoiceRole]: 
> org.ofbiz.entity.GenericEntityException: Error while inserting: 
> [GenericEntity:InvoiceRole][createdStamp,2013-10-09 
> 13:13:57.498(java.sql.Timestamp)][createdTxStamp,2013-10-09 
> 13:13:49.522(java.sql.Timestamp)][datetimePerformed,2013-10-09 
> 13:13:57.498(java.sql.Timestamp)][invoiceId,CI6(java.lang.String)][lastUpdatedStamp,2013-10-09
>  13:13:57.498(java.sql.Timestamp)][lastUpdatedTxStamp,2013-10-09 
> 13:13:49.522(java.sql.Timestamp)][partyId,DemoCustCompany(java.lang.String)][roleTypeId,PLACING_CUSTOMER(java.lang.String)]
>  (SQL Exception while executing the following:INSERT INTO public.INVOICE_ROLE 
> (INVOICE_ID, PARTY_ID, ROLE_TYPE_ID, DATETIME_PERFORMED, PERCENTAGE, 
> LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) 
> VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates 
> unique constraint "pk_invoice_role"<br/>  Detail: Key (invoice_id, party_id, 
> role_type_id)=(CI6, DemoCustCompany, PLACING_CUSTOMER) already exists.)). 
> Rolling back transaction.org.ofbiz.entity.GenericEntityException: Error while 
> inserting: [GenericEntity:InvoiceRole][createdStamp,2013-10-09 
> 13:13:57.498(java.sql.Timestamp)][createdTxStamp,2013-10-09 
> 13:13:49.522(java.sql.Timestamp)][datetimePerformed,2013-10-09 
> 13:13:57.498(java.sql.Timestamp)][invoiceId,CI6(java.lang.String)][lastUpdatedStamp,2013-10-09
>  13:13:57.498(java.sql.Timestamp)][lastUpdatedTxStamp,2013-10-09 
> 13:13:49.522(java.sql.Timestamp)][partyId,DemoCustCompany(java.lang.String)][roleTypeId,PLACING_CUSTOMER(java.lang.String)]
>  (SQL Exception while executing the following:INSERT INTO public.INVOICE_ROLE 
> (INVOICE_ID, PARTY_ID, ROLE_TYPE_ID, DATETIME_PERFORMED, PERCENTAGE, 
> LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) 
> VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates 
> unique constraint "pk_invoice_role"<br/>  Detail: Key (invoice_id, party_id, 
> role_type_id)=(CI6, DemoCustCompany, PLACING_CUSTOMER) already exists.)) 
> (Error while inserting: [GenericEntity:InvoiceRole][createdStamp,2013-10-09 
> 13:13:57.498(java.sql.Timestamp)][createdTxStamp,2013-10-09 
> 13:13:49.522(java.sql.Timestamp)][datetimePerformed,2013-10-09 
> 13:13:57.498(java.sql.Timestamp)][invoiceId,CI6(java.lang.String)][lastUpdatedStamp,2013-10-09
>  13:13:57.498(java.sql.Timestamp)][lastUpdatedTxStamp,2013-10-09 
> 13:13:49.522(java.sql.Timestamp)][partyId,DemoCustCompany(java.lang.String)][roleTypeId,PLACING_CUSTOMER(java.lang.String)]
>  (SQL Exception while executing the following:INSERT INTO public.INVOICE_ROLE 
> (INVOICE_ID, PARTY_ID, ROLE_TYPE_ID, DATETIME_PERFORMED, PERCENTAGE, 
> LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) 
> VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates 
> unique constraint "pk_invoice_role"<br/>  Detail: Key (invoice_id, party_id, 
> role_type_id)=(CI6, DemoCustCompany, PLACING_CUSTOMER) already exists.))))
> The createInvoiceForOrder service is called for each orderId in 
> createInvoicesFromShipments of InvoiceServices.java but the 
> createInvoiceForOrder calls createInvoiceRole which attempts to insert the 
> OrderRoles associated with the orderId which causes primary key violations.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to