Customising the Sales Order Item form issue


I am in the process of customising the Sales Order Item form.

I managed to create a section above the Warehouse and Reference section called “Latest Purchases”, my problem starts when I want to configure the actual content of that section.

I would like this section to be filled with the latest 5 purchases (Rate and date only) of that product, as displayed in Buying → Standard Reports → Item-wise Purchase History.

What would be the easiest way to achieve that?

Kind regards,

Add a custom HTML field and throw a formatted HTML table on change of the item.