My app was working fine with Version 1.99.2. I upgrade to Version 2.1.1 and it shows this error. I'm using DB2 for my database. PDTFF is new table defined by web2py so it has id field but the others are existing and doesn't have id field.
*Traceback (most recent call last):* File "C:\web2py\gluon\restricted.py", line 209, in restricted exec ccode in environment File "C:/web2py/applications/fedex/controllers/default.py", line 205, in <module> File "C:\web2py\gluon\globals.py", line 187, in <lambda> self._caller = lambda f: f() File "C:\web2py\gluon\tools.py", line 2838, in f return action(*a, **b) File "C:/web2py/applications/fedex/controllers/default.py", line 116, in next form = SQLFORM(db.PDTFF,record) File "C:\web2py\gluon\sqlhtml.py", line 1038, in __init__ inp = self.widgets.options.widget(field, default) File "C:\web2py\gluon\sqlhtml.py", line 226, in widget options = requires[0].options() File "C:\web2py\gluon\validators.py", line 2500, in _options options = self.other.options() File "C:\web2py\gluon\validators.py", line 484, in options self.build_set() File "C:\web2py\gluon\validators.py", line 471, in build_set records = self.dbset(table).select(*fields, **dd) File "C:\web2py\gluon\dal.py", line 8726, in __call__ query = self.db._adapter.id_query(query) File "C:\web2py\gluon\dal.py", line 631, in id_query return table._id != None File "C:\web2py\gluon\dal.py", line 7636, in __getitem__ return ogetattr(self, str(key)) AttributeError: 'Table' object has no attribute '_id' *Function argument list* (self=<Table TDMKNP00 (KNCTCD,KNKNCD,KNKNNM)>, key='_id') *Model* # coding: utf8 # Employee info table on HELPDESK dbh.define_table('tbluser', Field('name', length=255), Field('location', length=255), Field('emailaddress', length=255)) # Dept Master db.define_table('TDMBUP01', Field('BUSEC1', length=3), Field('BUBURK', length=12), primarykey=['BUSEC1']) # Country Master db.define_table('TDMCNP00', Field('CNCNCD', length=3), Field('CNCNNM', length=30), primarykey=['CNCNCD']) # Area 2 Master db.define_table('TDMKNP00', Field('KNCTCD', length=3), Field('KNKNCD', length=2), Field('KNKNNM', length=30), primarykey=['KNCTCD','KNKNCD']) # Purchase Order db.define_table('SDTH2P01', Field('H2DNO', length=8), Field('H2TRD1', 'integer'), Field('H2JJDN', length=8), Field('H2JJGN', 'integer'), Field('H2JDNO', length=8), Field('H2JGNO', 'integer'), Field('H2JCSC', length=3), Field('H2HSKB', length=1), Field('H2KSM', length=3), Field('H2PRCD', length=15), Field('H2PRKJ', length=50), Field('H2TRS', 'integer'), Field('H2HZS', 'integer'), primarykey=['H2DNO']) # Open FedEx Purchase Order db.define_table('SDTH2PF1', Field('H2DNO', length=8), Field('H2TRD1', 'integer'), Field('H2JJDN', length=8), Field('H2JJGN', 'integer'), Field('H2JDNO', length=8), Field('H2JGNO', 'integer'), Field('H2JCSC', length=3), Field('H2HSKB', length=1), Field('H2KSM', length=3), Field('H2PRCD', length=15), Field('H2PRKJ', length=50), Field('H2TRS', 'integer'), Field('H2HZS', 'integer'), primarykey=['H2DNO']) # Received Order db.define_table('SDTJ2P00', Field('J2DNO', length=8), Field('J2GNO', 'integer'), Field('J2TSCD',length=8), Field('J2TSK1',length=35), Field('J2TSK2',length=35), Field('J2TSPE',length=22), Field('J2ODA1',length=30), Field('J2ODA2',length=30), Field('J2ODA7',length=20), Field('J2KNCD',length=2), Field('J2CNCD',length=3), Field('J2OYUB',length=10), Field('J2OTEL',length=20), Field('J2KYSC',length=12), Field('J2NSD','integer'), primarykey=['J2DNO','J2GNO']) # FedEx Request Output file db.define_table('PDTFF', Field('FFDNO', length=8, label='HJ#'), Field('FFTRD', 'date', label="Requested"), Field('FFJCSC', length=3, label="Dept"), Field('FFBURK', length=12, label="Dept Name"), Field('FFJDNO', length=8, label="JJ#"), Field('FFJGNO', 'integer', label="JJ line#"), Field('FFJJDN', length=8, label="J# (JP)"), Field('FFJJGN', 'integer', label="J line# (JP)"), Field('FFACCT', length=9, label="FedEx Acct #"), Field('FFCUST', length=30, label="Company Name"), Field('FFNSD', 'date',label="Delivery Due"), Field('FFPRCD', length=15,label="Product Code"), Field('FFPRKJ', length=50,label="Part Number"), Field('FFTRS', 'integer',label="Quantity"), Field('FFTSK1',length=35,label="Name 1"), Field('FFTSK2',length=35,label="Name 2"), Field('FFTSPE',length=22,label="Attn:"), Field('FFODA1',length=30,label="Address 1"), Field('FFODA2',length=30,label="Adderss 2"), Field('FFODA7',length=20,label="City"), Field('FFKNCD',length=2,label="State"), Field('FFCNCD',length=3,label="Country"), Field('FFOYUB',length=10,label="Zip"), Field('FFOTEL',length=20,label="Phone"), Field('FFKYSC',length=12,label="Customer Order#"), Field('FFSPCL','boolean',label="Special Instruction"), Field('FFJPKB','boolean',label="JP Confirmed"), Field('FFRMKS',length=128,label="Remarks"), Field('FFCUSR',length=128,label="Created by"), Field('FFCDAT','datetime',label="Created on"), Field('FFUUSR',length=128,label="Updated by"), Field('FFUDAT','datetime',label="Updated on"), ) db.PDTFF.FFDNO.writable = False db.PDTFF.FFTRD.writable = False db.PDTFF.FFTRD.requires=IS_DATE(format='%m/%d/%y') db.PDTFF.FFJCSC.writable = False db.PDTFF.FFBURK.writable = False db.PDTFF.FFJDNO.writable = False db.PDTFF.FFJGNO.writable = False db.PDTFF.FFJJDN.writable = False db.PDTFF.FFJJGN.writable = False db.PDTFF.FFPRCD.writable = False db.PDTFF.FFPRKJ.writable = False db.PDTFF.FFACCT.requires=[IS_NOT_EMPTY(),IS_UPPER(),IS_LENGTH(9,9,error_message='enter 9 characters'),IS_UPPER()] db.PDTFF.FFCUST.requires=[IS_NOT_EMPTY(),IS_LENGTH(30,1),IS_UPPER()] db.PDTFF.FFNSD.requires=IS_DATE(format='%m/%d/%y',error_message='enter date as mm/dd/yy') db.PDTFF.FFTRS.requires=IS_INT_IN_RANGE(1,99999999,error_message='Cannot exceed 99,999,999') db.PDTFF.FFTSK1.requires=[IS_NOT_EMPTY(),IS_LENGTH(35,1),IS_UPPER()] db.PDTFF.FFTSK2.requires=IS_NULL_OR([IS_LENGTH(35,1),IS_UPPER()]) db.PDTFF.FFTSPE.requires=IS_NULL_OR([IS_LENGTH(22,1),IS_UPPER()]) db.PDTFF.FFODA1.requires=[IS_NOT_EMPTY(),IS_LENGTH(30,1),IS_UPPER()] db.PDTFF.FFODA2.requires=IS_NULL_OR([IS_LENGTH(30,1),IS_UPPER()]) db.PDTFF.FFODA7.requires=[IS_NOT_EMPTY(),IS_LENGTH(20,1),IS_UPPER()] # Dropdown list from Area 2 Master db.PDTFF.FFKNCD.requires=IS_NULL_OR(IS_IN_DB(db,'TDMKNP00.KNKNCD','%(KNKNNM)s')) db.PDTFF.FFOYUB.requires=[IS_NOT_EMPTY(),IS_LENGTH(20,1),IS_UPPER()] # Dropdown list from Country Master db.PDTFF.FFCNCD.requires=IS_IN_DB(db,'TDMCNP00.CNCNCD','%(CNCNNM)s') db.PDTFF.FFOTEL.requires=[IS_NOT_EMPTY(),IS_LENGTH(20,1),IS_UPPER()] db.PDTFF.FFKYSC.requires=[IS_NOT_EMPTY(),IS_LENGTH(12,1),IS_UPPER()] db.PDTFF.FFJPKB.writable = False db.PDTFF.FFRMKS.requires=IS_NULL_OR([IS_LENGTH(128,1),IS_UPPER()]) db.PDTFF.FFCUSR.writable = False db.PDTFF.FFCDAT.writable = False db.PDTFF.FFCDAT.requires=IS_DATETIME(format='%m/%d/%y %H:%M:%S') db.PDTFF.FFUUSR.writable = False db.PDTFF.FFUDAT.writable = False db.PDTFF.FFUDAT.requires=IS_DATETIME(format='%m/%d/%y %H:%M:%S') *Controller* def next(): keyHJ = request.args(0) or redirect(URL('index')) record = db.PDTFF(db.PDTFF.FFDNO==keyHJ) hj = db.SDTH2P01(db.SDTH2P01.H2DNO==keyHJ) # Get information from purcharse order transaction db.PDTFF.FFDNO.default = hj.H2DNO.strip() db.PDTFF.FFPRCD.default = hj.H2PRCD.strip() db.PDTFF.FFPRKJ.default = hj.H2PRKJ.strip() db.PDTFF.FFTRS.default = int(hj.H2TRS) db.PDTFF.FFJJDN.default = hj.H2JJDN.strip() db.PDTFF.FFJJGN.default = hj.H2JJGN db.PDTFF.FFJDNO.default = hj.H2JDNO.strip() db.PDTFF.FFJGNO.default = hj.H2JGNO db.PDTFF.FFJCSC.default = hj.H2JCSC.strip() # Get Dept name if hj.H2JCSC<>"": bu = db.TDMBUP01(db.TDMBUP01.BUSEC1==hj.H2JCSC) db.PDTFF.FFBURK.default = bu.BUBURK.strip() or None key1 = hj.H2JDNO key2 = hj.H2JGNO jj = db.SDTJ2P00((db.SDTJ2P00.J2DNO==key1) & (db.SDTJ2P00.J2GNO==key2)) # Get Received Order information if exist if jj <> None: db.PDTFF.FFKYSC.default = jj.J2KYSC.strip() db.PDTFF.FFTSK1.default = jj.J2TSK1.strip() db.PDTFF.FFTSK2.default = jj.J2TSK2.strip() db.PDTFF.FFTSPE.default = jj.J2TSPE.strip() db.PDTFF.FFODA1.default = jj.J2ODA1.strip() db.PDTFF.FFODA2.default = jj.J2ODA2.strip() db.PDTFF.FFODA7.default = jj.J2ODA7.strip() db.PDTFF.FFKNCD.default = jj.J2KNCD.strip() db.PDTFF.FFOYUB.default = jj.J2OYUB.strip() db.PDTFF.FFCNCD.default = jj.J2CNCD.strip() db.PDTFF.FFOTEL.default = jj.J2OTEL.strip() import datetime y = int(str(jj.J2NSD)[0:4]) m = int(str(jj.J2NSD)[4:6]) d = int(str(jj.J2NSD)[6:8]) db.PDTFF.FFNSD.default = datetime.date(y, m, d) # Login User and current date user = dba.auth_user(auth.user_id) db.PDTFF.FFCUSR.default = user.username.upper() db.PDTFF.FFCDAT.default = request.now db.PDTFF.FFTRD.default = request.now.date # Form editable or readonly if record == None and hj.H2HZS>0: # New entry form = SQLFORM(db.PDTFF,record) form.vars.FFUUSR = user.username.upper() form.vars.FFUDAT = request.now if request.vars.FFSPCL == 'on': # Automatically set JP Checked if not Special Instruction form.vars.FFJPKB = False else: form.vars.FFJPKB = True elif record <> None and record.FFJPKB<>True and hj.H2HZS>0: # Update when JP Chcked is unchcked # Only editable by Admin if auth.has_membership(role = 'admin'): db.PDTFF.FFJPKB.writable = True form = SQLFORM(db.PDTFF,record) form.vars.FFUUSR = user.username.upper() form.vars.FFUDAT = request.now elif record <> None and record.FFJPKB==True and hj.H2HZS>0 and auth.has_membership(role = 'admin'): # Update when JP Chcked is chcked. Only Admin can edit the form db.PDTFF.FFJPKB.writable = True form = SQLFORM(db.PDTFF,record) form.vars.FFUUSR = user.username.upper() form.vars.FFUDAT = request.now else: form = SQLFORM(db.PDTFF,record, readonly=True) # Read only if form.process(onvalidation=spcheck).accepted: session.flash = 'Form accepted' redirect(URL(request.args(1))) elif form.errors: response.flash = 'Form has errors' return dict(form=form) --