For the time being the following seems(!) to work: I want to show the socument with a direct relation to a company and those documents, which belong to a person, which belongs to the company company_id is the key.
r1=db((db.document.person==db.person.id) & (db.person.company == company_id)).select(db.document.ALL,orderby=db.document.name) r2=db(db.document.company == company_id).select(orderby=db.document.name) docs=r1|r2 nearly untested ! I raise the ticket in Google