-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_template_ticket.py
executable file
·60 lines (49 loc) · 2.06 KB
/
list_template_ticket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /usr/bin/env python3
# -*- encoding: utf-8 -*-
import sys
import argparse
import erppeek
import csv
import unidecode
from datetime import datetime
from dateutil import tz
from cfg_secret_configuration import odoo_configuration_user_test as odoo_configuration_user
###############################################################################
# Odoo Connection
###############################################################################
def init_openerp(url, login, password, database):
openerp = erppeek.Client(url)
uid = openerp.login(login, password=password, database=database)
user = openerp.ResUsers.browse(uid)
tz = user.tz
return openerp, uid, tz
openerp, uid, _ = init_openerp(
odoo_configuration_user['url'],
odoo_configuration_user['login'],
odoo_configuration_user['password'],
odoo_configuration_user['database'])
###############################################################################
# Configuration
###############################################################################
###############################################################################
# Script
###############################################################################
#reg_id = 39002
#for prop in openerp.Proposal.browse([("src_registration_id", "=", 39207)]):
#for prop in openerp.Proposal.browse(["|", ("src_registration_id", "=", reg_id), ("des_registration_id", "=", reg_id)]):
#for prop in openerp.Proposal.browse([]):
# print(prop.state, prop.create_uid, prop.des_registration_id, prop.src_registration_id)
def main():
# Configure arguments parser
parser = argparse.ArgumentParser(
description='Liste les tickets de créneau')
args = parser.parse_args()
for tmpl in openerp.ShiftTemplate.browse([("active", "=", True)],
order="start_time asc"):
for ticket in openerp.ShiftTemplateTicket.browse(
[("shift_type", "=", "ftop"),
("shift_template_id", "=", tmpl.id)]
):
print(tmpl, ticket.seats_max)
if __name__ == "__main__":
main()