I have been trying to extract data from a .mdb database and get it into Odoo 8 class columns.
This is my .py file
class attendance_biometric(osv.Model):
_name="attendance.biometric"
_rec_name='name'
_columns={
'fdate':fields.datetime('From Date'),
'tdate':fields.datetime('To Date'),
'code':fields.integer('Code'),
'name':fields.many2one('res.users','Employee Name', readonly=True),
'ref': fields.one2many('bio.data', 'bio_ref', 'Data'),
}
_defaults = {
'name': lambda obj, cr, uid, context: uid,
}
def confirm_submit(self, cr, uid, ids, context=None):
result=[]
DBfile = '/home/administrator/test.mdb'
conn = pyodbc.connect('DRIVER=MDBtools;DBQ='+DBfile)
cr = conn.cursor()
sql = '''
select InTime, OutTime, OutDeviceId, Duration from
AttendanceLogs '''
cr.execute(sql)
rows = cr.fetchall()
for row in enumerate(rows):
result.append(row)
raise osv.except_osv(_('Info'),_('Data : %s\n' % (result)))
Now after some re-work when I click submit button, the data shows up like in the following images
Could someone provide valuable input on this? like how to get those values into Odoo class columns(I meant assigning to the fields that of the class) and also how to get columns from two tables.