From 50e82c307a71f8ebc37e4747aab66c45e1bb33a3 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Mon, 29 Jul 2013 08:57:18 +0100 Subject: [PATCH] ADD defsult and sugegsted values; auto-install --- users_ldap_mail/__openerp__.py | 19 ++++++++++--------- users_ldap_mail/users_ldap_model.py | 12 ++++++------ users_ldap_mail/users_ldap_view.xml | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/users_ldap_mail/__openerp__.py b/users_ldap_mail/__openerp__.py index 97709502d..690613642 100644 --- a/users_ldap_mail/__openerp__.py +++ b/users_ldap_mail/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# This module copyright (C) 2013 Daniel Reis. +# Copyright (C) 2013 Daniel Reis (https://launchpad.com/~dreis-pt) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -20,21 +20,22 @@ ############################################################################## { -"name" : "LDAP mapping for user name and e-mail", -"version" : "1.0", -"depends" : ["auth_ldap"], -"author" : "Daniel Reis", -"description": """\ +'name': "LDAP mapping for user name and e-mail", +'version': "1.0", +'depends': ["auth_ldap"], +'author': "Daniel Reis (https://launchpad.com/~dreis-pt)", +'description': """\ Allows to define the LDAP attributes to use to retrieve user name and e-mail address. The default attribute used for the name is "cn". For Active Directory, you might prefer to use "displayName" instead. AD also supports the "mail" attribute, so it can be mapped into OpenERP. """, -"category" : "Tools", -"data" : [ +'category': "Tools", +'data': [ 'users_ldap_view.xml', ], -"installable": True, +'installable': True, +'auto_install': True, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/users_ldap_mail/users_ldap_model.py b/users_ldap_mail/users_ldap_model.py index 52b3899e8..0dd3bf169 100644 --- a/users_ldap_mail/users_ldap_model.py +++ b/users_ldap_mail/users_ldap_model.py @@ -23,21 +23,22 @@ from openerp.osv import fields, orm class CompanyLDAP(orm.Model): - _inherit='res.company.ldap' - _columns={ + _inherit = 'res.company.ldap' + _columns = { 'name_attribute': fields.char('Name Attribute', size=64, help="Default in 'cn'. For an AD you could use 'displayName' instead."), 'mail_attribute': fields.char('E-mail attribute', size=64, help="Active Directory uses the 'mail' attribute."), - } - + } + _defaults = { + 'mail_attribute': 'mail', + } def get_ldap_dicts(self, cr, ids=None): """ Copy of auth_ldap's funtion, changing only the SQL, so that it returns all fields in the table. """ - if ids: id_clause = 'AND id IN (%s)' args = [tuple(ids)] @@ -51,7 +52,6 @@ class CompanyLDAP(orm.Model): """, args) return cr.dictfetchall() - def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry): values = super(CompanyLDAP, self).map_ldap_attributes(cr, uid, conf, login, ldap_entry) diff --git a/users_ldap_mail/users_ldap_view.xml b/users_ldap_mail/users_ldap_view.xml index 9395e602f..945a5651e 100644 --- a/users_ldap_mail/users_ldap_view.xml +++ b/users_ldap_mail/users_ldap_view.xml @@ -8,7 +8,7 @@ - +