I have these tables:
db.define_table('marcas_definiciones',
Field('marca', 'string', label=T('Marca GG')),
Field('razon_zocial_gg', 'reference razones_zociales_gg'),
Field('ruc', 'string', label=T('RUC GG')),
format='%(marca)s')
db.define_table('cuentas_por_cobrar_y_pagar',
Field('marca', 'reference marcas_definiciones'),
Field('saldo_total_cobrar', 'float'),
Field('saldo_total_pagar', 'float'),
format='%(marca)s')
db.define_table('cobranzas',
Field('marca', 'reference cuentas_por_cobrar_y_pagar'),
Field('numero_comprobante', 'string'),
Field('nota', 'text'),
format='%(prefijo_comprobante)s %(numero_comprobante)s')
This is the driver:
def cuentas_por_cobrar_y_pagar():
response.view = 'finances/default.html'
form = SQLFORM.smartgrid(db.cuentas_por_cobrar_y_pagar, linked_tables=[
'cobranzas',
'pagos'
])
return dict(form=form,page_name="Cuentas por cobrar")
Where cuentas_por_cobrar_y_pagar
has a field that is marcas_definiciones
and table cobranzas
is a subtable of cuentas_por_cobrar_y_pagar
unique by the field marca
, the problem is that when I want to select the marca
in the cobranzas
table, this appears as the ID number but from the marca_definicion
table and not one of the marks in the cuentas_por_cobrar_y_pagar
table.
How can I solve it?