[ 
https://issues.apache.org/jira/browse/OFBIZ-5345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13859499#comment-13859499
 ] 

Paul Foxworthy commented on OFBIZ-5345:
---------------------------------------

Hi again Christian,

I tried your steps on the demo site, and I did come up with an error, but not 
the primary key violation:

The Following Errors Occurred:
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: Error in simple-method [Check if the invoiceStatus is in progress 
[file:/home/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml#InvoiceStatusInProgress]]:
 ; [Can only update Invoice, when status is in-process...current status: ])

I wonder if the two orders are confusing things, so OFBiz creates an invoice 
for the items from the first ship group, and tries to update the invoice with 
the item from the second order, but the status has not yet been set.

I will investigate further.

All I did in addition to Christian's steps was to approve the orders, and set 
the status for the Shipment to Pack, not Pick.

Cheers

Paul Foxworthy


> 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.java.patch, 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.5#6160)

Reply via email to