Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2602 Widoki

Actually I'm trying to fetch data in listview from mssql server

My python code

 @api.depends('bio')
def _get_chk_out(self):
for record in self:
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=OWNER-PC\SQLEXPRESS;DATABASE=etimetracklite;UID=test;PWD=rimt')
cr = conn.cursor()
b_id=record.bio
current=datetime.datetime.now().date()
back_thirty=current-datetime.timedelta(days=30)
back_thirty=back_thirty.strftime("%Y-%m-%d")

cr.execute("select OutTime from AttendanceLogs where EmployeeId=? AND AttendanceDate Between ? AND ?", b_id,str(back_thirty),str(current))

if(cr.fetchone()==None):
record.chk_out='-'
else:
rows = cr.fetchall()

_logger.info('INFO GG %s',rows)
for i in rows:
record.chk_out = i[0]

but it display only one row in listview...

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lip 22
9151
1
cze 21
2446
2
lut 21
299
5
wrz 20
14342
4
cze 20
49733