How to link Accounts Receivable with Customer?

See: Fixing Account For Supplier and Customer - #4 by alasdair