In a customer project we extended the drop shipment process to manage an agreement for the supplier related to the order context.
For a supplier we have different agreements with same products but on diffrent price
During sales order process we resolve the purchase agreement that match the case and put on oisg related to the supplier. Like that when the drop shipment process run it to resolve the product price for the agreement present on the oisg. With this implementation we have an adaptable system to manage complex case.
Properly I improved :
- add an attribute on entity OrderItemShipGroup.supplierAgreementId
- add an attribute on entity OrderHeader.agreementId (necessary when you update the order to keep the price)
- update the service caculatePurchasePrice for resolve the price from a agreement if it's present
- update the shoppingCart to insert a purchase agreement
If you are interested to test it, you can apply the patch, create a sales order with the product DS-1000, select on the oisg the supplier DemoSupplier and the agreement DS-1000-PURCH
I detected a possible improvement on OrderItemPriceInfo to set the origin price from an agreement because when you create a purchase order, ofbiz update automaticly the SupplierProduct.lastPrice that would not logical, the price is under an agreement.