我正在尝试使用路由username, password and database_name
从网页中检索/web/my_route
来创建用户。它成功创建了用户。但我需要在网页中添加一个字段master_password
并对其进行身份验证以创建用户。我试图找出master_password身份验证功能,但除了代码
@http.route('/web/database/create', type='json', auth="none")
def create(self, fields):
params = dict(map(operator.itemgetter('name', 'value'), fields))
db_created = request.session.proxy("db").create_database(
params['super_admin_pwd'],
params['db_name'],
bool(params.get('demo_data')),
params['db_lang'],
params['create_admin_pwd'])
if db_created:
request.session.authenticate(params['db_name'], 'admin', params['create_admin_pwd'])
return db_created
但我找不到函数create_database
。
我该怎么做?任何建议??
答案 0 :(得分:1)
Create the field on the form, and on submit check it against odoo.tools.config['admin_passwd']
. This is the master admin password.