You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Daniel Watford (Jira)" <ji...@apache.org> on 2022/12/05 19:05:00 UTC

[jira] [Commented] (OFBIZ-12608) No way to input shipment carrier information while creating purchase order

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

Daniel Watford commented on OFBIZ-12608:
----------------------------------------

I have recently hit this issue while trying to bring up 'OFBiz from scratch' as I want to avoid loading demo data if possible.

I used the ofbizsetup application to create the company and a facility (warehouse).

I then created a party for a supplier and assigned them the role, SUPPLIER. I also assigned a Postal Address to the party and assigned location purposes of 

General Correspondence Address, Payment (AR) Address, Primary Address, Purchase Return Address and Shipping Origin Address.

Next, I created a finished good product and assigned the supplier.

I then created a purchase order to purchase the product from the supplier, with shipping to the company's facility. This failed with an error message that foreign key constraint ORDER_ITSG_CSHM was violated when using key values (STANDARD, {_}NA{_}, CARRIER). This matches the error in James' debug log:
{quote}(STANDARD, _NA_, CARRIER) is not present in table "carrier_shipment_method".{quote}
The foreign key constrain violation occurs as we need a CarrierShipmentMethod entity created in advance of purchase order creation. 

The necessary CarrierShipmentMethod exists if using demo data or if you create a ProductStore using the ofbizsetup application.

When creating a product store, the ofbizsetup application will import file applications/commonext/data/OfbizSetupShippingData.xml. This file contains the entities needed to support purchase order creation.

However, I don't have a need for a ProductStore at this stage of my testing, and I would rather not create one as a side effect of getting some seed data into the database. I therefore propose that the following entities are moved from OfbizSetupShippingData.xml into a seed data file:
{quote} 
<Party partyId="{_}NA{_}" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
<Person partyId="{_}NA{_}"/>
<PartyRole partyId="{_}NA{_}" roleTypeId="CARRIER"/>
<PartyStatus partyId="{_}NA{_}" statusId="PARTY_ENABLED" statusDate="2001-01-01 12:00:00.0"/>
<CarrierShipmentMethod partyId="{_}NA{_}" roleTypeId="CARRIER" shipmentMethodTypeId="STANDARD" sequenceNumber="5"/>


{quote}
Some other entities may also need moving to seed data. Those can be identified during implementation and testing.
 

> No way to input shipment carrier information while creating purchase order
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-12608
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12608
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: 18.12.05
>         Environment: Ubuntu 20.04 LTS
> PostgreSQL 12
>            Reporter: Xiguang Wang
>            Assignee: Daniel Watford
>            Priority: Major
>
> Hi Community,
>  
> We've deployed ofbiz 18.12.05 on our own server and are trying to use it without much development.
>  
> Today I tested the "New Purchase Order" function. The first steps are fine. But with the final step "Create Order", the system threw an exception saying shipment/carrier information was missing. I looked through the UI and didn't find any place to input shipment/carrier information. I think it should be a bug with the default UI.
>  
> I modified OrderServices.java and added these code as a workaround:
> {code:java}
>        if (valueObj.get("carrierRoleTypeId") == null) {
>            valueObj.set("carrierRoleTypeId", "CARRIER");
> +          valueObj.set("carrierPartyId", "SFEXPRESS");
> +          valueObj.set("shipmentMethodTypeId", "SFEXPRESS_STD");
>        }{code}
>  
> SFEXPRESS is an existing carrier I added to the system earlier. This code works fine.
>  
> The debug information is attached as below.
> {code:java}
> 20:57:17.387 [QUIET] [system.out]   Detail: Key (shipment_method_type_id, carrier_party_id, carrier_role_type_id)=(STANDARD, _NA_, CARRIER) is not present in table "carrier_shipment_method".)) (Error while inserting: [GenericEntity:OrderItemShipGroup][carrierPartyId,_NA_(java.lang.String)][carrierRoleTypeId,CARRIER(java.lang.String)][contactMechId,10010(java.lang.String)][createdStamp,2022-04-28 20:57:17.357(java.sql.Timestamp)][createdTxStamp,2022-04-28 20:57:17.311(java.sql.Timestamp)][estimatedDeliveryDate,2022-04-28 00:00:00.0(java.sql.Timestamp)][facilityId,10000(java.lang.String)][giftMessage,null()][isGift,N(java.lang.String)][lastUpdatedStamp,2022-04-28 20:57:17.357(java.sql.Timestamp)][lastUpdatedTxStamp,2022-04-28 20:57:17.311(java.sql.Timestamp)][maySplit,N(java.lang.String)][orderId,SO2204170486(java.lang.String)][shipAfterDate,null()][shipByDate,null()][shipGroupSeqId,00001(java.lang.String)][shipmentMethodTypeId,STANDARD(java.lang.String)][shippingInstructions,null()][supplierAgreementId,null()][supplierPartyId,null()][telecomContactMechId,null()][vendorPartyId,null()] (SQL Exception while executing the following:INSERT INTO public.ORDER_ITEM_SHIP_GROUP (ORDER_ID, SHIP_GROUP_SEQ_ID, SHIPMENT_METHOD_TYPE_ID, SUPPLIER_PARTY_ID, SUPPLIER_AGREEMENT_ID, VENDOR_PARTY_ID, CARRIER_PARTY_ID, CARRIER_ROLE_TYPE_ID, FACILITY_ID, CONTACT_MECH_ID, TELECOM_CONTACT_MECH_ID, TRACKING_NUMBER, SHIPPING_INSTRUCTIONS, MAY_SPLIT, GIFT_MESSAGE, IS_GIFT, SHIP_AFTER_DATE, SHIP_BY_DATE, ESTIMATED_SHIP_DATE, ESTIMATED_DELIVERY_DATE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: insert or update on table "order_item_ship_group" violates foreign key constraint "order_itsg_cshm"
> 20:57:17.413 [QUIET] [system.out] Caused by: java.lang.Exception: Current Location Stack
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.entity.jdbc.SQLProcessor.rollback(SQLProcessor.java:185) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.entity.datasource.GenericDAO.insert(GenericDAO.java:112) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.entity.datasource.GenericHelperDAO.create(GenericHelperDAO.java:66) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.entity.GenericDelegator.create(GenericDelegator.java:874) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.entity.GenericDelegator.storeAll(GenericDelegator.java:1323) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.entity.GenericDelegator.storeAll(GenericDelegator.java:1279) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.order.order.OrderServices.createOrder(OrderServices.java:1035) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
> 20:57:17.413 [QUIET] [system.out] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
> 20:57:17.413 [QUIET] [system.out] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
> 20:57:17.413 [QUIET] [system.out] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.service.engine.StandardJavaEngine.serviceInvoker(StandardJavaEngine.java:100) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java:57) ~[ofbiz.jar:?]
> 20:57:17.413 [QUIET] [system.out] at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:415) ~[ofbiz.jar:?]
> 20:57:17.414 [QUIET] [system.out] at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:240) ~[ofbiz.jar:?]
> 20:57:17.414 [QUIET] [system.out] at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:88) ~[ofbiz.jar:?]
> 20:57:17.414 [QUIET] [system.out] at org.apache.ofbiz.order.shoppingcart.CheckOutHelper.createOrder(CheckOutHelper.java:613) ~[ofbiz.jar:?]
> 20:57:17.414 [QUIET] [system.out] at org.apache.ofbiz.order.shoppingcart.CheckOutEvents.createOrder(CheckOutEvents.java:488) ~[ofbiz.jar:?]
> 20:57:17.414 [QUIET] [system.out] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
> 20:57:17.414 [QUIET] [system.out] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
> 20:57:17.414 [QUIET] [system.out] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
> 20:57:17.414 [QUIET] [system.out] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
> 20:57:17.414 [QUIET] [system.out] at org.apache.ofbiz.webapp.event.JavaEventHandler.invoke(JavaEventHandler.java:86) ~[ofbiz.jar:?]
> 20:57:17.414 [QUIET] [system.out] ... 39 more{code}
>  
> I hope it is enough for devs to locate the bug. Thanks for your patience and looking forward to any comments.
>  
> James.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)