[ADD] add sync_base module and add dependecy sync_google_contact and remove unuse code

bzr revid: sbh@tinyerp.com-20110214072049-pg9e1onvxifcmvhr
This commit is contained in:
Sbh (OpenERP) 2011-02-14 12:50:49 +05:30
parent 62df31924c
commit b99cb58c90
14 changed files with 212 additions and 118 deletions

View File

@ -28,9 +28,6 @@ class res_users(osv.osv):
'gmail_user': fields.char('User Name', size=64,),
'gmail_password': fields.char('Password', size=64),
}
def check_login(self, cr, uid, ids, context=None):
# we can check login detail is correct or not
return {'type': 'ir.actions.act_window_close'}
res_users()
# vim:expandtab:smartindent:toabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,62 +1,20 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_google_user_form">
<field name="name">res.users.google.form</field>
<record id="view_users_gogole_form" model="ir.ui.view">
<field name="name">res.users.google.form1</field>
<field name="model">res.users</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Google User">
<group colspan="2" col="2">
<field name="gmail_user"/>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook[last()]" position="inside">
<page string=" Synchronization ">
<separator string="Google User Detail" colspan="4" />
<field name="gmail_user"/>
<field name="gmail_password" password="True"/>
<field name="address_id" string="User Profile"/>
</group>
<separator string="" colspan="4" />
<group colspan="2" col="2">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_login" string="Checking" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_google_user_tree">
<field name="name">google.user.tree</field>
<field name="model">res.users</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Google User">
<field name="gmail_user"/>
<field name="gmail_password" password="True"/>
</tree>
</field>
</record>
<record id="action_google_user" model="ir.actions.act_window">
<field name="name">Gooogle User</field>
<field name="res_model">res.users</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window.view" id="action_google_user_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_google_user_tree"/>
<field name="act_window_id" ref="action_google_user"/>
</record>
<record model="ir.actions.act_window.view" id="action_google_user_form">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_google_user_form"/>
<field name="act_window_id" ref="action_google_user"/>
</record>
<menuitem id="base.menu_sales" name="Sales"
parent="base.menu_base_partner" sequence="1" />
<menuitem name="Google User" id="menu_google_contact"
parent="base.menu_address_book" action="action_google_user"
sequence="20" />
</page>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,39 @@
# -*- 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': [
],
'demo_xml': [],
'installable': True,
'active': False,
'certificate': '',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,52 @@
# -*- 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,orm
#framework to handle synchronization with multiple app
# we will improve the code and function
class res_partner_sync_base:
_inherit = "res.partner.address"
def create(self, cr, uid, vals, context=None):
id = super(res_partner_sync_base, self).create(cr, uid, vals, context=context)
return id
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
if context is None:
context = {}
return super(res_partner_sync_base, self).write(cr, uid, ids, vals, context=context)
def unlink(self, cr, uid, ids, context=None):
osv.osv.unlink(self, cr, uid, ids, context=context)
return True
def sync_create(self, cr, uid, vals, context=None,synchronize=True):
return True
def sync_modify(self, cr, uid, ids, vals, context=None, synchronize=True):
return True
def sync_modify(self, cr, uid, ids,context=None, synchronize=True):
return True
res_partner_sync_base()

View File

@ -0,0 +1,24 @@
# -*- 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

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<openerp>
<data>
</data>
</openerp>

View File

@ -0,0 +1,36 @@
# -*- 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,orm
from tools.translate import _
class synchronize_base(osv.osv_memory):
_description ='Synchronize Contact'
_name = "synchronize.base"
_columns = {
'tools': fields.selection([('none','Nothing')], 'App to synchronize with'),
}
def action_synchronize(self, cr, uid, ids, context=None):
return {}
synchronize_base()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -27,11 +27,11 @@
'description': """The module adds google contact in partner address""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'depends': ['base','sync_base','google_base_account',],
'init_xml': [],
'update_xml': [
#'google_contact_view.xml',
'wizard/google_contact_import_view.xml'
#'wizard/google_contact_import_view.xml'
],
'demo_xml': [],
'installable': True,

View File

@ -66,5 +66,7 @@ class google_lib(object):
self.contact.DeleteContact(selected_entry.GetEditLink().href)
return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -2,49 +2,6 @@
<openerp>
<data>
<record model="ir.ui.view" id="view_google_contact_form">
<field name="name">google.contact.form</field>
<field name="model">google.contact</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Google Contact">
<group colspan="2" col="2">
<field name="user"/>
<field name="password" password="True"/>
</group>
<separator string="" colspan="4" />
<group colspan="2" col="2">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="get_contact" string="Contact " type="object" icon="terp-mail-message-new"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_google_contact_tree">
<field name="name">google.contact.tree</field>
<field name="model">google.contact</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Google Contact">
<field name="user"/>
<field name="password" password="True"/>
</tree>
</field>
</record>
<menuitem id="base.menu_sales" name="Sales"
parent="base.menu_base_partner" sequence="1" />
<record model="ir.actions.act_window" id="google_contact_act">
<field name="name">Google Contact</field>
<field name="res_model">google.contact</field>
<field name="view_mode">tree,form,</field>
<field name="view_id" ref="view_google_contact_tree"/>
</record>
<menuitem name="Google Contact" id="menu_google_contact"
parent="base.menu_base_partner" action="google_contact_act"
sequence="3" />
</data>
</openerp>

View File

@ -19,6 +19,6 @@
#
##############################################################################
import google_contact_import
#import google_contact_import
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -25,15 +25,16 @@ from tools.translate import _
from sync_google_contact import sync_google_contact
class google_contact_import(osv.osv_memory):
_description ='Google Contact'
_name = 'google.contact.import'
_name = "synchronize.base"
_inherit = 'synchronize.base'
_columns = {
'user': fields.char('User Name', size=64, required=True),
'password': fields.char('Password', size=64),
}
def get_contact(self, cr, uid, ids, context=None):
'tools': fields.selection([('gmail','Gmail')], 'App to synchronize with'),
'create_partner':fields.selection([('group','Group'),('email_address','Email address'),('gmail_user','Gmail user')], ''),
}
def import_contact(self, cr, uid, ids, context=None):
# Only see the result, we will change the code
addresss_obj = self.pool.get('res.partner.address')
for obj in self.browse(cr, uid, ids, context=context):
google_obj = sync_google_contact.google_lib(obj.user, obj.password)

View File

@ -9,16 +9,13 @@
<field name="arch" type="xml">
<form string="Import Google Contacts">
<group colspan="4" col="4">
<field name="user"/>
<newline/>
<label string="ex: user@gmail.com" align="1.0" colspan="2"/>
<newline/>
<field name="password" password="True"/>
<field name="tools"/>
<field name="create_partner" />
</group>
<separator string="" colspan="4"/>
<group colspan="2" col="2">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="get_contact" string="Import Contacts" type="object" icon="terp-personal+"/>
<button name="import_contact" string="Import Contacts" type="object" icon="terp-personal+"/>
</group>
</form>
</field>