diff --git a/addons/google_base_account/__init__.py b/addons/google_base_account/__init__.py index 44a5aabe277..e1a476431af 100644 --- a/addons/google_base_account/__init__.py +++ b/addons/google_base_account/__init__.py @@ -20,6 +20,7 @@ ############################################################################## import google_base_account +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/google_base_account/__openerp__.py b/addons/google_base_account/__openerp__.py index 4844d9961c4..409ca205c74 100644 --- a/addons/google_base_account/__openerp__.py +++ b/addons/google_base_account/__openerp__.py @@ -31,6 +31,7 @@ 'init_xml': [], 'update_xml': [ 'google_base_account_view.xml', + 'wizard/google_login_view.xml', ], 'demo_xml': [], 'installable': True, diff --git a/addons/google_base_account/wizard/__init__.py b/addons/google_base_account/wizard/__init__.py new file mode 100644 index 00000000000..a6b9c644a1e --- /dev/null +++ b/addons/google_base_account/wizard/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import google_login + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/google_base_account/wizard/google_login.py b/addons/google_base_account/wizard/google_login.py new file mode 100644 index 00000000000..e60af4305f4 --- /dev/null +++ b/addons/google_base_account/wizard/google_login.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields,osv,orm +from tools.translate import _ +import gdata.contacts +import gdata.contacts.service + +from sync_google_contact import sync_google_contact + +class google_login(osv.osv_memory): + _description ='Google Contact' + _name = 'google.login' + _columns = { + 'user': fields.char('User Name', size=64, required=True), + 'password': fields.char('Password', size=64), + } + + def check_login(self, cr, uid, ids, context=None): + if context==None: + context={} + data=self.read(cr,uid,ids)[0] + user=data['user'] + password=data['password'] + gd_client = gdata.contacts.service.ContactsService() + gd_client.email = user + gd_client.password = password + gd_client.source = 'OpenERP' + try: + gd_client.ProgrammaticLogin() + res={'gmail_user':user, + 'gmail_password':password} + self.pool.get('res.users').write(cr,uid,uid,res,context=context) + except Exception, e: + raise osv.except_osv(_('Error!'),_('%s' % (e))) + + return {} +google_login() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/google_base_account/wizard/google_login_view.xml b/addons/google_base_account/wizard/google_login_view.xml new file mode 100644 index 00000000000..0f9df4c32f3 --- /dev/null +++ b/addons/google_base_account/wizard/google_login_view.xml @@ -0,0 +1,38 @@ + + + + + + google.login.form + google.login + form + +
+ + + + + + +