-
Notifications
You must be signed in to change notification settings - Fork 4
/
28_create_member_space_user.py
39 lines (32 loc) · 1.21 KB
/
28_create_member_space_user.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
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
import erppeek
from cfg_secret_configuration import odoo_configuration_user
import time
###############################################################################
# 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, database
openerp, uid, tz, db = init_openerp(
odoo_configuration_user['url'],
odoo_configuration_user['login'],
odoo_configuration_user['password'],
odoo_configuration_user['database'])
###############################################################################
# Script
###############################################################################
def create_member_space_user():
members = openerp.ResPartner.browse(
[('is_member', '=', True), ('email', '!=', False)]
)
members.create_memberspace_user()
# Run the create function
if not openerp:
print ">>>>>>>> Cannot connect to Server <<<<<<<<<"
else:
create_member_space_user()