I have those tables:
Produto = db.define_table('produto',
Field('ficha_tecnica', 'upload', label=T("Ficha Tecnica")),
Field('cliente_id', 'integer', label=T("Cliente ID")),
Field('cliente_nome', 'string', label=T("Nome Cliente"))
)
Pedido = db.define_table('pedido',
Field('produto_id', db.produto),
Field('ordem_de_servico', 'string', label=T("Ordem de Servico")),
Field('tipo_de_pedido', 'integer', label=T("Tipo de Pedido"))
)
Materia_Prima = db.define_table('materia_prima',
Field('pedido_id', 'integer', label=T("ID DO PEDIDO")),
Field('data_recebimento', 'date', label=T("Data Recebimento")),
)
#requires
Pedido.produto_id.requires = IS_IN_DB(db(Produto), 'produto.id', '%(cliente_nome)s - referencia: %(referencia)s') Materia_Prima.pedido_id.requires = IS_IN_DB(db(Pedido), 'pedido.id', )
I need that the field Materia_Prima.pedido_id, persist the pedido_id but when i select in the dropdow of a SQLFORM the information is:
'%(cliente_nome)s - referencia: %(ordem_de_servico)s'
but the field cliente_nome is a filed from Produto.
is it Possible?
Rgds
Diego