Introduction

As explained in the module documentation, level pricing infrastructure needs algorithms in order to work. These algorithms indicates which way will be followed to set prices. These prices are set based on the information stored in the level pricing infrastructure. Normally, each algorithm will correspond with a module which will contain the algorithm for ERP and (optionally) for Openbravo Web POS.

Module dependencies

If your algorithm will be used just in the ERP side (sales order window) the module will depend on Level pricing infrastructure module. However if your module will work also in Openbravo Web POS, it will depend on Retail level pricing module. It happens because is needed to move level pricing information to Web POS side.

In this how to we are going to implement an algorithm to be used in Openbravo ERP and in Openbravo Web POS, so it will depend on Retail level pricing module.

Step 1: Create the module to store the algorithm

View larger

View larger

View larger

Step 2: Register the algorithm into the list of available algorithms

View larger

Step 3: Configure a product to use the new algorithm

View larger

Step 4: Develop the algorithm for ERP Side

To develop the algorithm for ERP we will take advantage of the hook called "OrderLineQtyChangedHook". This hook is executed when some events happens in an order line.

In the implementation we should select the price and then return it to the main flow.