Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-5347

Shipping costs not recalculated after changing sales order shipment method

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: 14.12.01, 13.07.03, 16.11.01
    • Component/s: order
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015, Community Day 2 - 2015

      Description

      Sales order shipping costs are not recalculated when ship group shipment methods are changed. Its required that the order items be updated before the new shipment method costs are calculated and applied to the order.

      The same logic that calculates the new shipment method costs when order items are updated should be applied when the shipment method is updated.

      1. OFBIZ-5347.patch
        15 kB
        Divesh Dutta

        Activity

        Hide
        diveshdut Divesh Dutta added a comment -

        Here on updating shipping information system does not update any information other that the selected shipping method and shipping. There can be many areas (not only shipping estimates) that should be re-calculated, when you change shipping information.

        Like:

        1) Shipping Estimates

        2) Sales Tax

        3) Promotions (You can have promotion set up on some shipping methods)

        There could be other as well.

        So, keeping in mind all re-calculations, we can reload the cart when user edits shipping information (as we do during editing order items) and save that cart again. By doing this all the re-calculations will be handled.

        Other community members,

        Please help what do you think on this proposal ?

        If others agree with this approach, then I can work on this solution.

        Show
        diveshdut Divesh Dutta added a comment - Here on updating shipping information system does not update any information other that the selected shipping method and shipping. There can be many areas (not only shipping estimates) that should be re-calculated, when you change shipping information. Like: 1) Shipping Estimates 2) Sales Tax 3) Promotions (You can have promotion set up on some shipping methods) There could be other as well. So, keeping in mind all re-calculations, we can reload the cart when user edits shipping information (as we do during editing order items) and save that cart again. By doing this all the re-calculations will be handled. Other community members, Please help what do you think on this proposal ? If others agree with this approach, then I can work on this solution.
        Hide
        lektran Scott Gray added a comment -

        That sounds like a good approach to me Divesh

        Show
        lektran Scott Gray added a comment - That sounds like a good approach to me Divesh
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        +1

        Show
        jacques.le.roux Jacques Le Roux added a comment - +1
        Hide
        diveshdut Divesh Dutta added a comment -

        As per the discussion in this thread, fixed the issue. Now when user will change shipping method or shipping address below given process will take place:

        1) load cart from order

        2) Check if shipping address is changed (new address can be added or existing address of party can be used), then get all the shipping methods based on changed address and see if existing shipping method of order is available in new list of shipping methods. If existing shipping method of order is available then you are good and then load the cart. All the recalculations will be done .

        3) If existing shipping method of order is not available in list of shipping methods returned based on new address, then choose the first shipping method from the list of shipping method and set it into the cart. Now save the cart into the order. Again all the recalculations will be done. Message will be shown to user to inform that new shipping method is set because last one was not applicable based on the given address.

        4) If only shipping method is changed and address is not changed, then simply load cart and save the cart. All the recalculations will be done.

        Added new service "updateShipGroupShipInfo" which will do all the above work. Also added new SECA rule and triggered "resetGrandTotal" service on "updateShipGroupShipInfo" service to reset grand total of order because saveUpdatedCartToOrder method does not take care of that.

        Have tested this patch and now every thing works as per the expectation.

        Show
        diveshdut Divesh Dutta added a comment - As per the discussion in this thread, fixed the issue. Now when user will change shipping method or shipping address below given process will take place: 1) load cart from order 2) Check if shipping address is changed (new address can be added or existing address of party can be used), then get all the shipping methods based on changed address and see if existing shipping method of order is available in new list of shipping methods. If existing shipping method of order is available then you are good and then load the cart. All the recalculations will be done . 3) If existing shipping method of order is not available in list of shipping methods returned based on new address, then choose the first shipping method from the list of shipping method and set it into the cart. Now save the cart into the order. Again all the recalculations will be done. Message will be shown to user to inform that new shipping method is set because last one was not applicable based on the given address. 4) If only shipping method is changed and address is not changed, then simply load cart and save the cart. All the recalculations will be done. Added new service "updateShipGroupShipInfo" which will do all the above work. Also added new SECA rule and triggered "resetGrandTotal" service on "updateShipGroupShipInfo" service to reset grand total of order because saveUpdatedCartToOrder method does not take care of that. Have tested this patch and now every thing works as per the expectation.
        Hide
        mridul.pathak Mridul Pathak added a comment -

        Divesh,
        Thank you for the patch. I'll review/test it and commit if all seems fine.

        Show
        mridul.pathak Mridul Pathak added a comment - Divesh, Thank you for the patch. I'll review/test it and commit if all seems fine.
        Hide
        diveshdut Divesh Dutta added a comment -

        Committed the fix of this issue in trunk in revision number: 1686635.

        Fixed in 14.12 in revision number : 1686641

        Fixed in 13.07 in revision number: 1686647

        Show
        diveshdut Divesh Dutta added a comment - Committed the fix of this issue in trunk in revision number: 1686635. Fixed in 14.12 in revision number : 1686641 Fixed in 13.07 in revision number: 1686647
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Fixed "Fix Version/s" field

        Show
        jacques.le.roux Jacques Le Roux added a comment - Fixed "Fix Version/s" field

          People

          • Assignee:
            diveshdut Divesh Dutta
            Reporter:
            ofbizzer Christian Carlow
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development

                Agile