Now, The problem is only with this function db.define_table("notas", audit, Field("store_id",db.stores, default=store.store_id, writable=False, label='Sucursal',comment='A la que se encuentra asignado'), Field('nota', 'integer', default=None, writable=False,label='No.Nota(Sistema)',comment='Remisión generada por el Sistema'), Field('notaFisica','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser Numero positivo entre 2500 y 66500')),label='No.Nota(Elaborada)',comment='Remision'), Field('vale', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento para Arm1/Len1'), Field('folio', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(110000,191999,error_message='Debe ser Numero positivo entre 110000 y 191999')),label='Num.Folio'), Field('first_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'), Field('last_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'), Field('end_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'), Field('tel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Casa'), Field('tel1','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Trabajo'), Field('cel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Celular',comment='Sin 044'), Field('email','string', default=None, requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'), Field('armazon1',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'), Field('color1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'), Field('lente1',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC1','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 1'), Field('tinte1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon2',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon2'), Field('color2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon2'), Field('lente2',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC2','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 2'), Field('tinte2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon3',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon3'), Field('color3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon3'), Field('lente3',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC3','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 3'), Field('tinte3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('lc4',db.lc, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lc.id','%(tecnoGradua)s % (marca)s %(duracion)s %(oftalmico)s %(cosmetico)s $% (promo)s')),label='L/C (4)'), Field('color4','string',default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('lc5',db.lc, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lc.id','%(tecnoGradua)s % (marca)s %(duracion)s %(oftalmico)s %(cosmetico)s $% (promo)s')),label='L/C (5)'), Field('color5','string',default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field("producto6",db.productos, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'productos.id','% (producto)s %(modelo)s %(caract1)s %(caract2)s %(caract3)s %(caract4)s $%(promo)s'))), Field('cantidad6','integer',default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(0,1e100,error_message='Debe ser Numero positivo')),label='Cantidad producto6',comment='más de 1'), Field("producto7",db.productos, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'productos.id','% (producto)s %(modelo)s %(caract1)s %(caract2)s %(caract3)s %(caract4)s $%(promo)s'))), Field('cantidad7','integer',default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(0,1e100,error_message='Debe ser Numero positivo')),label='Cantidad producto7',comment='más de 1'), Field("vendedor",db.auth_user, default=user_id, requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s %(last_name)s %(end_name)s'))), Field("total", "double", default=0, writable=False), Field("anticipo", "double", default=0, requires=[IS_NOT_EMPTY(error_message='No puede estar vacio'),IS_FLOAT_IN_RANGE(0,10000,error_message='Debe ser un numero positivo entre 0 y 10000')]), Field("pagos", "double", default=0, writable=False), Field("saldo", "double", default=0, writable=False), Field("fechaEntrega", "date",default=(request.now +datetime.timedelta(14)), label='Fecha de Entrega'), Field("optometrista",db.auth_user, default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','% (first_name)s %(last_name)s %(end_name)s'))), Field('retiOdEsf','double', default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo Der.Esf.'), Field('retiOdCil','double', default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo Der.Cil.'), Field('retiOdEje','integer', default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo Der.Eje'), Field('retiOiEsf','double', default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo Izq.Esf.'), Field('retiOiCil','double', default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo Izq.Cil.'), Field('retiOiEje','integer', default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo Izq Eje'), Field('adicion','double', default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0.75,3.51)),label='Adición'), Field('dipC','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(35,85)), label='D.I.P. Cerca(mm)'), Field('dipL','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(35,85)), label='D.I.P. Lejos(mm)'), Field('alt','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(10,30)), label='Altura Centro Óptico(mm)'), Field('observaciones','string', default=None), Field('diabetes','string', default=None), Field('hipertension','string', default=None), Field('garantia', 'integer', default=None, label='Garantia de la Nota'), Field('entregado','boolean', default=False, writable=False), Field('entregadoEl', 'datetime', default=None, label='Entregado el', writable=False))
On Dec 8, 11:17 pm, drayco <antrod...@gmail.com> wrote: > Ok, it's work's now, I reset my instance and all work well > > Thank's > > On Dec 8, 10:43 pm, drayco <antrod...@gmail.com> wrote: > > > :D, well only for this function "realizar_venta", because other > > crud.create works well > > > On Dec 8, 10:35 pm, drayco <antrod...@gmail.com> wrote: > > > > :D wel olny crud.create doesn't work > > > > this is the track > > > > Traceback (most recent call last): > > > File "/home/drayco/web2py/gluon/restricted.py", line 188, in > > > restricted > > > exec ccode in environment > > > File "/home/drayco/web2py/applications/opticaluz/controllers/ > > > ventas.py", line 1086, in <module> > > > File "/home/drayco/web2py/gluon/globals.py", line 95, in <lambda> > > > self._caller = lambda f: f() > > > File "/home/drayco/web2py/gluon/tools.py", line 2315, in f > > > return action(*a, **b) > > > File "/home/drayco/web2py/applications/opticaluz/controllers/ > > > ventas.py", line 1056, in realizar_venta > > > return dict(form=crud.create(db.notas, next=URL(r=request, > > > f='leer_ventas'), onvalidation=procesing_nota, > > > onaccept=procesing_taller)) > > > File "/home/drayco/web2py/gluon/tools.py", line 2889, in create > > > deletable=False, > > > File "/home/drayco/web2py/gluon/tools.py", line 2805, in update > > > formstyle=self.settings.formstyle > > > File "/home/drayco/web2py/gluon/sqlhtml.py", line 792, in __init__ > > > inp = self.widgets.options.widget(field, default) > > > File "/home/drayco/web2py/gluon/sqlhtml.py", line 205, in widget > > > options = requires[0].options() > > > File "/home/drayco/web2py/gluon/validators.py", line 2350, in > > > _options > > > options = self.other.options() > > > File "/home/drayco/web2py/gluon/validators.py", line 424, in options > > > self.build_set() > > > File "/home/drayco/web2py/gluon/validators.py", line 408, in > > > build_set > > > records = self.dbset.select(*self.fields, **dd) > > > File "/home/drayco/web2py/gluon/sql.py", line 4369, in select > > > return self.db._adapter.select(self.query,fields,attributes) > > > File "/home/drayco/web2py/gluon/sql.py", line 976, in select > > > query = self._select(query,fields,attributes) > > > File "/home/drayco/web2py/gluon/sql.py", line 911, in _select > > > raise SyntaxError, 'Set: no tables selected' > > > SyntaxError: Set: no tables selected > > > > And the code of the controller is > > > > def realizar_venta(): > > > return dict(form=crud.create(db.notas, next=URL(r=request, > > > f='leer_ventas'), onvalidation=procesing_nota, > > > onaccept=procesing_taller)) > > > > On Dec 8, 10:30 pm, drayco <antrod...@gmail.com> wrote: > > > > > Hi, I updated trunk version, but error still happens, but now all my > > > > functions that use crud.(search,read,create) doesn't work > > > > > this the track > > > > > Traceback (most recent call last): > > > > File "/home/drayco/web2py/gluon/restricted.py", line 188, in > > > > restricted > > > > exec ccode in environment > > > > File "/home/drayco/web2py/applications/opticaluz/controllers/ > > > > gerencia.py", line 1417, in <module> > > > > File "/home/drayco/web2py/gluon/globals.py", line 95, in <lambda> > > > > self._caller = lambda f: f() > > > > File "/home/drayco/web2py/gluon/tools.py", line 2315, in f > > > > return action(*a, **b) > > > > File "/home/drayco/web2py/applications/opticaluz/controllers/ > > > > gerencia.py", line 278, in ventas > > > > if form.accepts(request.vars,session): > > > > File "/home/drayco/web2py/gluon/sqlhtml.py", line 1159, in accepts > > > > self.vars.id = self.table.insert(**fields) > > > > File "/home/drayco/web2py/gluon/sql.py", line 3735, in insert > > > > return new_fields > > > > File "/home/drayco/web2py/gluon/sql.py", line 690, in insert > > > > query = self._insert(table,fields) > > > > AttributeError: 'BaseAdapter' object has no attribute 'cursor' > > > > > On Dec 8, 9:48 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > Thanks for your tests. One more time please. > > > > > > On Dec 8, 9:37 pm, drayco <antrod...@gmail.com> wrote: > > > > > > > Hi, I updated trunk version, but error still happens > > > > > > > this the track > > > > > > > Traceback (most recent call last): > > > > > > File "/home/drayco/web2py/gluon/restricted.py", line 188, in > > > > > > restricted > > > > > > exec ccode in environment > > > > > > File "/home/drayco/web2py/applications/opticaluz/controllers/ > > > > > > gerencia.py", line 1417, in <module> > > > > > > File "/home/drayco/web2py/gluon/globals.py", line 95, in <lambda> > > > > > > self._caller = lambda f: f() > > > > > > File "/home/drayco/web2py/gluon/tools.py", line 2315, in f > > > > > > return action(*a, **b) > > > > > > File "/home/drayco/web2py/applications/opticaluz/controllers/ > > > > > > gerencia.py", line 278, in ventas > > > > > > if form.accepts(request.vars,session): > > > > > > File "/home/drayco/web2py/gluon/sqlhtml.py", line 1159, in accepts > > > > > > self.vars.id = self.table.insert(**fields) > > > > > > File "/home/drayco/web2py/gluon/sql.py", line 3735, in insert > > > > > > return self._db._adapter.insert(self,self._listify(fields)) > > > > > > File "/home/drayco/web2py/gluon/sql.py", line 690, in insert > > > > > > raise e > > > > > > AttributeError: 'BaseAdapter' object has no attribute 'cursor' > > > > > > > On Dec 8, 9:07 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > > > I think this is now fixed. Please give it a try. > > > > > > > > On Dec 8, 6:42 pm, drayco <antrod...@gmail.com> wrote: > > > > > > > > > Hi this the code in the controller: > > > > > > > > > def form_factory(*a): > > > > > > > > return SQLFORM(SQLDB(None).define_table(*a)) > > > > > > > > > def ventas(): > > > > > > > > form=form_factory('myform', > > > > > > > > > SQLField('inicio','date',default=request.now.date(),requires=IS_NOT_EMPTY()), > > > > > > > > SQLField('fin','date',default=request.now.date())) > > > > > > > > total='' > > > > > > > > regs='' > > > > > > > > totalcorte='' > > > > > > > > cortesias='' > > > > > > > > totalc='' > > > > > > > > cancel='' > > > > > > > > totalgaran='' > > > > > > > > garantias='' > > > > > > > > totalcero='' > > > > > > > > cero='' > > > > > > > > inicio = '' > > > > > > > > fin = '' > > > > > > > > if form.accepts(request.vars,session): > > > > > > > > response.flash='Formulario aceptado' > > > > > > > > from datetime import datetime > > > > > > > > inicio = datetime.strptime(str(form.vars.inicio) + " > > > > > > > > 00:00:00", "%Y-%m-%d %H:%M:%S") > > > > > > > > if form.vars.fin==None: > > > > > > > > fin = inicio > > > > > > > > fin = fin.replace(hour=23,minute=59,second=59) > > > > > > > > else: > > > > > > > > fin = datetime.strptime(str(form.vars.fin) + " > > > > > > > > 23:59:59", > > > > > > > > "%Y-%m-%d %H:%M:%S") > > > > > > > > Gerente = db.auth_user(user_id) > > > > > > > > total = > > > > > > > > SQLTABLE(db((db.notas.created_on>inicio)&(db.notas.created_on<fin)&(db.notas.store_id==Gerente.store_id)&(db.notas.active==True)&(db.notas.garantia==None)&(db.notas.vale==None)). > > > > > > > > \ > > > > > > > > > select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/ > > > > > > > > db.notas.id.count()),\ > > > > > > > > headers={'COUNT(notas.id)':'Num.Notas', > > > > > > > > 'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo', > > > > > > > > 'SUM(notas.pagos)':'Pagos', > > > > > > > > 'SUM(notas.saldo)':'Saldo','SUM(notas.total)/ > > > > > > > > COUNT(notas.id)':'Promedio'}) > > > > > > > > regs = > > > > > > > > SQLTABLE(db((db.notas.created_on>inicio)&(db.notas.created_on<fin)&(db.notas.store_id > > > > > > > > == > > > > > > > > Gerente.store_id)&(db.notas.active==True)&(db.notas.garantia==None)&(db.notas.vale==None)). > > > > > > > > \ > > > > > > > > > select(db.notas.vendedor,db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/ > > > > > > > > db.notas.id.count(),\ > > > > > > > > orderby=~(db.notas.total.sum()/ > > > > > > > > db.notas.id.count()),groupby=db.notas.vendedor),\ > > > > > > > > > headers={'notas.vendedor':'Vendedor','COUNT(notas.id)':'Num.Notas','SUM(notas.total)':'Total','SUM(notas.anticipo)':'Anticipo','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldo','SUM(notas.total)/ > > > > > > > > COUNT(notas.id)':'Promedio'}) > > > > > > > > totalc = > > > > > > > > SQLTABLE(db((db.notas.created_on>inicio)&(db.notas.created_on<fin)&(db.notas.store_id==Gerente.store_id)&(db.notas.active==False)). > > > > > > > > \ > > > > > > > > > select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum()), > > > > > > > > \ > > > > > > > > headers={'COUNT(notas.id)':'Num.Notas', > > > > > > > > 'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo', > > > > > > > > 'SUM(notas.pagos)':'Pagos', 'SUM(notas.saldo)':'Saldo'}) > > > > > > > > cancel = > > > > > > > > SQLTABLE(db((db.notas.created_on>inicio)&(db.notas.created_on<fin)&(db.notas.store_id > > > > > > > > == Gerente.store_id)&(db.notas.active==False)).\ > > > > > > > > > select(db.notas.vendedor,db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(), > > > > > > > > \ > > > > > > > > > > > > > > > > orderby=~db.notas.id.count(),groupby=db.notas.vendedor),\ > > ... > > read more »