Get_value filtering by parent field


I would like to create “last price” column on Sales Invoice (pt-br: “ultimo preço”) that shows last price for that item, for that customer.


Is it possible to achieve that by script?

I was trying to use

get_value(doctype, fieldname, filters=None, as_dict=True, debug=False, parent=None)

but I’m struggling at filtering by parent’s field ‘customer’:

it would be something like:

 doctype: "Sales Invoice Item"
 fieldname: "rate"
 filters: [
 	["item_name", "=", itemName]
 	//something to access parent and filter by "customer"

Do you have any suggestion? I saw something about someone creating new field on child that fetches customer from parent… but it may limit some uses… Thanks in advance!