If the user set no purchase order on an invoice, it makes no sense
to warn them about details being different.
The onchange for the purchase_id field is not only run when the user
sets a purchase, but also when they open a new, empty form view.
Normally this causes no problems, but in some contexts the user
may want to define defaults for the payment term or bank account.
If these are defined, they will not be False on a new draft invoice,
but there will be no purchase, so the code interpreted the values
as having "changed".
We avoid this by simply not checking for changes if no purchase has
been set on the invoice.
When invoicing from dropshipping, the same picking serves for both
invoicing sale and purchase orders. The OCA module
stock_dropshipping_dual_invoice makes that this happens, but
as the picking is the same, it contains both the sale and the
purchase reference, making that the resulting invoices don't have
the correct payment mode. This is harmless for the rest of
operations, as the dictionary query is provided with the proper
default value. On v9, dropshipping dual invoice has been merged
into core, so this patch for sure will be welcome in that version
(if the used method is the same).