How does the module calculate margins on orders that have been placed before its installation?
First of all, it is important to know that natively, when an order is placed on the shop, PrestaShop stores in the order information, in addition to the sales price, the supplier purchase price of the ordered products. This makes it possible to calculate the margin made. However, in order for these supplier purchase prices to be properly stored by PrestaShop at the time of the order, they must have been entered in your back-office, for each product, in the supplier information (in 1.7, it is in the "Options" tab of a product, in the "Suppliers" section). If the purchase price is filled only in the "Pricing" tab of the product (in "Cost price" field), then, when an order is placed on your shop, it will not be retrieved by PrestaShop.
When you install our module on your shop, it will retrieve information about orders placed on your shop before its installation so that you can calculate a history of margins made over time. However, it will have access to the purchase prices of the products as they were at the date of the orders, only if these purchase prices have always been entered at the supplier information level. If this is not the case, then it will look for the values of the purchase prices of these products as they are now, i.e. at the time of its installation on your shop (it will first look to see if the information is present at the level of supplier information, then if not, it will look at the level of the "cost price" section of the "Pricing" tab of the product). Thus, the calculated margins will not be extremely precise if your purchase prices have changed over time and if these prices were not provided in the supplier information.
That being said, for all future orders, there will be no problem of accuracy in the calculation of margins. Indeed, our module stores the values of the supplier purchase prices of the products at the time of placing an order, regardless of where you enter them and therefore corrects the weakness of PrestaShop.