Fix bugs + use actions auth session get/set for sessions

This commit is contained in:
Hubert Van De Walle
2026-09-16 15:43:14 +02:00
parent 12440a11f9
commit 35337afdf0
3 changed files with 199 additions and 152 deletions
+4 -9
View File
@@ -13,6 +13,8 @@ from .client import OdooClient, OdooError
from .render import render_gantt
from .schedule import DAY_NAMES, get_schedules, resolve_employees
BASE_URL = "https://www.odoo.com"
def parse_date(value: str) -> date:
return date.fromisoformat(value)
@@ -80,13 +82,6 @@ def main() -> int:
default=None,
help="End date, YYYY-MM-DD, inclusive (default: same as --date-from)",
)
parser.add_argument("--url", default="https://www.odoo.com", help="Odoo base URL")
parser.add_argument(
"--session-file",
default=Path(__file__).resolve().parents[2] / "session_id.txt",
type=Path,
help="Path to a file containing the session_id cookie value",
)
parser.add_argument(
"--tz",
default=None,
@@ -130,8 +125,8 @@ def main() -> int:
parser.error("date_from must be before or equal to date_to")
try:
client = OdooClient.from_session_file(args.url, args.session_file, debug=args.debug)
except (FileNotFoundError, ValueError) as exc:
client = OdooClient.from_actions(BASE_URL, debug=args.debug)
except ValueError as exc:
print(f"error: {exc}", file=sys.stderr)
return 1