Here's what I had in mind, if of any interest. This function does not work (and it's a simplified one that dosn't take into account the multiple=True in db.customer.guitar_ref). I'm not sure why it dosn't work. I think it's because I call a function in the first arg of IS_IN_DB. If someone could confirm that or explain me where I'm wrong, it would quench my thirst of learning.
def find_guitar(db,row): if row.customer_ref!=None : cust=row.customer_ref guit=db.customer[cust].guitar_ref q=db.guitar.id==guit else : q=db.guitar.id>0 return q db.invoice.guitar_ref.requires=lambda r:IS_IN_DB(db(find_guitar(db,r)),'guitar.id') -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.