Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Where is logged the default template user in python code?

By
Pascal Tremblay
on 8/11/15, 4:48 PM 984 views

Hello there,

You know, when you disconnect a user from odoo, the auth_signup.template_user_id user is automatically logged.

I'm searching the exact place in the code where this auth_signup.template_user_id is logged. I would want to place a condition there to chose between different template users...

Where should I write my condition?

Thanks to help


UPDATE #1

Why it is impossible to get a log error from the file ./odoo-8.0-20150809/openerp/addons/auth_signup/res_config.py ???

No trace in the log when I connect. No trace when I start Odoo. No trace when I disconnect.

See my file content :


import logging

_logger = logging.getLogger(__name__)

from openerp.osv import osv, fields

from openerp.tools.safe_eval import safe_eval

class base_config_settings(osv.TransientModel):

_inherit = 'base.config.settings'

_columns = {

'auth_signup_reset_password': fields.boolean('Enable password reset from Login page',

help="This allows users to trigger a password reset from the Login page."),

'auth_signup_uninvited': fields.boolean('Allow external users to sign up',

help="If unchecked, only invited users may sign up."),

'auth_signup_template_user_id': fields.many2one('res.users',

string='Template user for new users created through signup'),

}

def get_default_auth_signup_template_user_id(self, cr, uid, fields, context=None):

icp = self.pool.get('ir.config_parameter')

# we use safe_eval on the result, since the value of the parameter is a nonempty string

_logger.error("get_default_auth_signup_template_user_id")

return {

'auth_signup_reset_password': safe_eval(icp.get_param(cr, uid, 'auth_signup.reset_password', 'False')),

'auth_signup_uninvited': safe_eval(icp.get_param(cr, uid, 'auth_signup.allow_uninvited', 'False')),

'auth_signup_template_user_id': safe_eval(icp.get_param(cr, uid, 'auth_signup.template_user_id', 'False')),

}

def set_auth_signup_template_user_id(self, cr, uid, ids, context=None):

config = self.browse(cr, uid, ids[0], context=context)

icp = self.pool.get('ir.config_parameter')

# we store the repr of the values, since the value of the parameter is a required string

_logger.error("set_auth_signup_template_user_id")

icp.set_param(cr, uid, 'auth_signup.reset_password', repr(config.auth_signup_reset_password))

icp.set_param(cr, uid, 'auth_signup.allow_uninvited', repr(config.auth_signup_uninvited))

icp.set_param(cr, uid, 'auth_signup.template_user_id', repr(config.auth_signup_template_user_id.id))

 


0
FEDERICO LEONI
On 8/11/15, 7:55 PM

A quick search with

grep -inR "auth_signup.template_user_id".

 drove me to

addons/auth_signup/res_config.py 
addons/auth_signup/auth_signup_data.xml

 I didn't find any other "call". Hope it helps.


 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/11/15, 4:48 PM
Seen: 984 times
Last updated: 8/11/15, 10:22 PM