Christian Carlow created OFBIZ-5345:
---------------------------------------

             Summary: 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


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