When doc_key does not contain invoice_reference ?

Suggestions:
System does not set the invoice reference in the doc key when there is no history of an invoice for that item.
Following are the dockey is selected by the system:
i) Site+Customer+Item+Lot+Invoice (used Only in this case if there is a history of an invoice) if there is a history of an invoice then the system will auto populate the invoice number. Else it will set any of the next/below doc keys).
ii) Site+Customer+Item+Lot
iii) Site+Item+Lot
iv) Customer+Item.
Note :- If these combinations do not exist then the system will fetch the rate from Price List.
Read more about What is min rate history Concept ? Link