Hibou Odoo Suite: Purchase by Sale History
The purpose of this documentation is to outline the use case and processes for the Purchase By Sale History for Odoo.
The Purchase by Sale History wizard reviews product sales history from previous months, then calculates and increments the quantity to purchase for each product based on the number of months you wish to procure in order to have stock on hand.
When launched, this wizard does the following:
If no products are on the Request for Quotation/Purchase Order, then the wizard looks at all products supplied by the selected vendor.
If there are products are on the Request for Quotation/Purchase Order, then the wizard looks at only those products.
The wizard then looks at sales history to determine how much has sold over a period of time, where period of time is user-selectable on the wizard.
Once sales for a period of time has been determined, Y days worth of of product will be filled as the quantity on the PO, where Y days is a user-input field on the wizard.
First thing's first, we want to install the module! Navigate to the Apps application and search for 'Purchase by Sale History'. When ready, click the Install button.
Good to Know!
This module requires the Purchases, Sales, and Inventory applications. However, if you do not already have these applications installed, Odoo will install them for you during this module's installation!
First, navigate to the Purchases app.
Creating the Request for Quotation/Purchase Order
This will bring you to a list view of all Request for Quotations (RFQ). Click Create.
Select the vendor from whom you are purchasing from the Vendor drop-down.
If you would like to purchase specific products at this time, add those products to the RFQ by clicking Add an Item. When all products have been added, or no products have been added if you would like the wizard to run for all products supplied by your selected vendor, hit Save.
Using the Purchase by Sale History Wizard
When ready, hit Fill by Sales to launch the wizard.
This will present you with a pop-up modal. Enter the following information:
Sales History Start: The first day the wizard should look at to calculate sales history for each product. This date field is automatically set to 30 days from today, but can be changed if desired.
Sales History End: The last day the wizard should look at to calculate sales history for each product.This date field is automatically set to today, but can be changed if desired.
Days to Procure: How many days of stock the wizard should calculate and add to the RFQ, based on the sales history data from Sales History Start through Sales History End. This field is automatically set to 30 days, but can be changed if desired.
Two additional fields will be displayed, but are not user editable:
History Days: Based on the Sales History Start and Sales History End inputs, the number of days of sales history that will be reviewed by the wizard.
Product Count: Products on the RFQ or products that the vendor provides, if no products were added to the RFQ.
When ready, hit Run.
Depending on History Days and Product Count it may take several moments for the wizard to run its calculations.
When the wizard has completed its calculations, the Qty column for each product will be incremented to the appropriate quantity based on your Days to Procure selection. If no products were added to the RFQ, it will now have all products supplied by the selected vendor that must be purchased in order to meet your Days to Procure selection.
Purchase by Sale History Calculations
Sales History for a product is computed as an average per day. This number is then multiplied by the number of days of stock you wish to procure in order to get the quantity that should be ordered.
Additionally, any products that are on the RFQ but do not have sales history during the specified time frame will have their quantity set to zero.
This module adds a new transient model `purchase.sale.history.make` with various fields and methods used in the product computation using sales history, along with the form view for the wizard.
Interested? Check out our GitHub repo!