[ADD]import_google: Add two files
bzr revid: dbr@tinyerp.com-20110613071042-b1zp3enejqip7z5p
This commit is contained in:
parent
1737deabb1
commit
0e588677ed
|
@ -37,7 +37,7 @@ class crm_installer(osv.osv_memory):
|
|||
'thunderbird': fields.boolean('Thunderbird', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
|
||||
'outlook': fields.boolean('MS-Outlook', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
|
||||
'wiki_sale_faq': fields.boolean('Sale FAQ', help="Helps you manage wiki pages for Frequently Asked Questions on Sales Application."),
|
||||
'import_google': fields.boolean('Google Contacts', help="Imports contacts from your google account."),
|
||||
'import_google': fields.boolean('Google Import', help="Imports contacts from your google account."),
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
'update_xml': [
|
||||
'sync_google_calendar_view.xml',
|
||||
'wizard/import_google_data_view.xml',
|
||||
'wizard/google_import_message_view.xml'
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test': [
|
||||
|
|
|
@ -20,4 +20,5 @@
|
|||
##############################################################################
|
||||
import import_google
|
||||
import import_google_data
|
||||
import google_import_message
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# -*- 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 osv
|
||||
from osv import fields
|
||||
|
||||
|
||||
class google_import_message(osv.osv):
|
||||
"""Import Message"""
|
||||
|
||||
_name = "google.import.message"
|
||||
_description = "Import Message"
|
||||
_columns = {
|
||||
'name': fields.text('Message', readonly=True),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context == None:
|
||||
context = {}
|
||||
res = super(google_import_message, self).default_get(cr, uid, fields, context=context)
|
||||
res.update({'name': context.get('message')})
|
||||
return res
|
||||
|
||||
google_import_message()
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Import Message Form View -->
|
||||
<record model="ir.ui.view" id="view_google_import_message_form">
|
||||
<field name="name">google.import.message.form</field>
|
||||
<field name="model">google.import.message</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Import Google Data">
|
||||
<group>
|
||||
<field name='name' nolabel='1'/>
|
||||
</group>
|
||||
<separator string="" colspan="4"/>
|
||||
<group colspan="4">
|
||||
<group colspan="2"/>
|
||||
<group colspan="2">
|
||||
<button icon="gtk-ok" special="cancel" string="_Ok"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -143,7 +143,20 @@ class synchronize_google_contact(osv.osv_memory):
|
|||
imp = google_import(self, cr, uid, 'google', "synchronize_google_contact", gmail_user, context)
|
||||
imp.set_table_list(tables)
|
||||
imp.start()
|
||||
return {}
|
||||
return{}
|
||||
# context.update({'message': "Data Imported Successffully from Google."})
|
||||
# model_pool = self.pool.get('ir.model.data')
|
||||
# model_data_ids = model_pool.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'google.import.message.form')])
|
||||
# resource_id = model_pool.read(cr, uid, model_data_ids, fields)
|
||||
# return {
|
||||
# 'view_type': 'form',
|
||||
# 'view_mode': 'form',
|
||||
# 'res_model': 'google.import.message',
|
||||
# 'views': [(resource_id, 'form')],
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'target': 'new',
|
||||
# 'context': context,
|
||||
# }
|
||||
|
||||
def import_calendar_events(self, cr, uid, ids, context=None):
|
||||
if context == None:
|
||||
|
@ -170,7 +183,20 @@ class synchronize_google_contact(osv.osv_memory):
|
|||
imp = google_import(self, cr, uid, 'import_google', "import_google_calendar", [gmail_user], context)
|
||||
imp.set_table_list(table)
|
||||
imp.start()
|
||||
return {}
|
||||
|
||||
context.update({'message': "Data Imported Successffully from Google."})
|
||||
model_pool = self.pool.get('ir.model.data')
|
||||
model_data_ids = model_pool.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'google.import.message.form')])
|
||||
resource_id = model_pool.read(cr, uid, model_data_ids, fields)
|
||||
return {
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'google.import.message',
|
||||
'views': [(resource_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
}
|
||||
|
||||
synchronize_google_contact()
|
||||
|
||||
|
|
Loading…
Reference in New Issue