Some fixes for the odoo attendance thing
This commit is contained in:
+11
-13
@@ -9,16 +9,14 @@ from datetime import (
|
||||
timedelta,
|
||||
date as d_date
|
||||
)
|
||||
import (
|
||||
requests,
|
||||
argparse,
|
||||
sys,
|
||||
os,
|
||||
getpass,
|
||||
json,
|
||||
math,
|
||||
logging
|
||||
)
|
||||
import requests
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import getpass
|
||||
import json
|
||||
import math
|
||||
import logging
|
||||
from random import randint
|
||||
from typing import (
|
||||
List,
|
||||
@@ -76,7 +74,7 @@ class Config(dict):
|
||||
parser.add_argument('-c', '--config', help='Configfile', default=configfile)
|
||||
|
||||
# Odoo Verbindungsparameter
|
||||
parser.add_argument('-l', '--url', dest='url' help='Odoo Server URL (z.B. http://localhost:8069)')
|
||||
parser.add_argument('-l', '--url', dest='url', help='Odoo Server URL (z.B. http://localhost:8069)')
|
||||
parser.add_argument('-d', '--database', dest='database', help='Datenbankname')
|
||||
parser.add_argument('-u', '--username', dest='username', help='Benutzername')
|
||||
parser.add_argument('-p', '--password', dest='password', help='Passwort oder API-Key')
|
||||
@@ -240,7 +238,7 @@ class OdooAttendance:
|
||||
|
||||
def set_auto_attendance(self):
|
||||
date = self.date
|
||||
day = self.rand_duration(config.duration)
|
||||
day = self.rand_duration()
|
||||
begin, _bm, _bs = calc_timevalue(config.begin)
|
||||
assert len(day) % 2, f"{day} ist nicht ungerade"
|
||||
assert int(begin) in range(6, 13), "Beginn muss zwischen 5 und 13 Uhr sein"
|
||||
@@ -285,7 +283,6 @@ class OdooAttendance:
|
||||
def main():
|
||||
|
||||
try:
|
||||
config = Config()
|
||||
odoo = OdooAttendance()
|
||||
|
||||
logging.info(f"Mitarbeiter gefunden: {odoo.employee['name']} (ID: {odoo.employee['id']})")
|
||||
@@ -314,4 +311,5 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
config = Config()
|
||||
exit(main())
|
||||
|
||||
Reference in New Issue
Block a user