[REM] sync_google_contact: Removed sync_base module and its dependancy from sync_google_contact.

bzr revid: uco@tinyerp.com-20110228123847-nu1tt215zxvhfea9
This commit is contained in:
Ujjvala Collins (OpenERP) 2011-02-28 18:08:47 +05:30
parent 662cc9202b
commit fb430f07e9
10 changed files with 24 additions and 241 deletions

View File

@ -19,7 +19,7 @@
#
##############################################################################
from osv import fields,osv,orm
from osv import fields,osv
class res_users(osv.osv):
_inherit = "res.users"

View File

@ -74,7 +74,7 @@ class google_login(osv.osv_memory):
}
self.pool.get('res.users').write(cr, uid, uid, res, context=context)
except :
raise osv.except_osv(_('Error'), _("Authication fail check the user and password !"))
raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !"))
return self._get_next_action(cr, uid, context=context)

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import sync_base
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Google Contact',
'version': '1.0',
'category': 'Generic Modules/Others',
'description': """The module adds synchronization with multiple app """,
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'init_xml': [],
'update_xml': [
'wizard/sync_base_view.xml'
],
'demo_xml': [],
'installable': True,
'active': False,
'certificate': '',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import synchronize_base
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,40 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="sync_base_import_wizard_view">
<field name="name">Synchronize contact</field>
<field name="model">synchronize.base.contact.wizard.import</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Import contact from external adress book">
<field name="tools"/>
<newline />
<separator string="" colspan="4"/>
<group colspan="4" col="4">
<group colspan="2"/>
<group colspan="2">
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
<button name="action_synchronize" string="Import" type="object" icon="terp-stock_effects-object-colorize"/>
</group>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="act_google_contact_import_form">
<field name="name">Import contacts from your google account</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">synchronize.base.contact.wizard.import</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="sync_base_import_wizard_view" />
</record>
<menuitem name="Import contacts from your google account" id="menu_sync_contact"
parent="base.menu_address_book" action="act_google_contact_import_form"
sequence="40" />
</data>
</openerp>

View File

@ -1,61 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
from tools.translate import _
class synchronize_base(osv.osv_memory):
_description ='Synchronize base import contact '
_name = "synchronize.base.contact.wizard.import"
def _get_tools_name(self, cr, user, context):
"""
@return the list of value of the selection field
should be overwritten by subclasses
"""
return []
_columns = {
'tools': fields.selection(_get_tools_name, 'App to synchronize with'),
}
def action_synchronize(self, cr, uid, ids, context=None):
wizard_data = self.browse(cr, uid, ids, context=context)
return self._get_action(cr, uid, wizard_data[0].tools, context=context)
def _get_action(self, cr, uid, tools, context=None):
if not tools:
raise osv.except_osv(_("Error !"),_("Select App to synchronize with."))
return self._get_actions_dic(cr, uid, context=context)[tools]
def _get_actions_dic(self, cr, uid, context=None):
"""
this method should be overwritten in specialize module
@return the dictonnaries of action
"""
return {'none' : {'type': 'ir.actions.act_window_close' }}
synchronize_base()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -24,10 +24,10 @@
'name': 'Google Contact',
'version': '1.0',
'category': 'Generic Modules/Others',
'description': """The module adds google contact in partner address""",
'description': """The module adds google contact in partner address""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base','google_base_account','sync_base'],
'depends': ['base','google_base_account'],
'init_xml': [],
'update_xml': [
'wizard/google_contact_import_view.xml'

View File

@ -30,53 +30,6 @@ try:
except ImportError:
raise osv.except_osv(_('Google Contacts Import Error!'), _('Please install gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list'))
class google_base_import(osv.osv_memory):
_inherit = 'synchronize.base.contact.wizard.import'
def _get_tools_name(self, cr, user, context):
"""
@return the list of value of the selection field
should be overwritten by subclasses
"""
names = super(google_base_import, self)._get_tools_name(cr, user, context=context)
names.append(('gmail','Gmail address book'))
return names
_columns = {
'tools': fields.selection(_get_tools_name, 'App to synchronize with'),
}
def _get_actions_dic(self, cr, uid, context=None):
"""
this method should be overwritten in specialize module
@return the dictonnaries of action
"""
actions = super(google_base_import, self)._get_actions_dic(cr, uid, context=context)
data_obj = self.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, uid, 'google_base_account', 'view_google_login_form')
view_id = False
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
value = {
'name': _('Import Contact'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'google.login.contact',
'view_id': False,
'context': context,
'views': [(view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
actions['gmail'] = value
return actions
google_base_import()
class google_contact_import(osv.osv_memory):
_inherit = 'google.login'
_name = 'google.login.contact'

View File

@ -23,5 +23,25 @@
</form>
</field>
</record>
<!--
Login Action
-->
<record model="ir.actions.act_window" id="act_google_login_form">
<field name="name">Import contacts from your google account</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">google.login.contact</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="google_base_account.view_google_login_form" />
</record>
<menuitem id="menu_sync_contact"
parent="base.menu_address_book"
action="act_google_login_form"
sequence="40" />
</data>
</openerp>