[IMP] Add wizard and tuto for google synchro. add permission missing on calendar object

bzr revid: jke@openerp.com-20131211163849-z438c5d8m7w4qt3l
This commit is contained in:
jke-openerp 2013-12-11 17:38:49 +01:00
parent ce8a4968de
commit 9a130e3157
19 changed files with 152 additions and 0 deletions

View File

@ -10,3 +10,4 @@ access_crm_meeting_type_sale_manager,crm.meeting.type.manager,model_crm_meeting_
access_crm_meeting_type_sale_user,crm.meeting.type.user,model_crm_meeting_type,base.group_user,1,0,0,0
access_crm_meeting_type_sale_user,crm.meeting.type.salesman,model_crm_meeting_type,base.group_sale_salesman,1,0,0,0
access_crm_meeting_type_manager,crm.meeting.type.manager,model_crm_meeting_type,base.group_system,1,1,1,1
access_calendar_alarm_manager,access_calendar_alarm_manager,model_calendar_alarm_manager,,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
10 access_crm_meeting_type_sale_user crm.meeting.type.user model_crm_meeting_type base.group_user 1 0 0 0
11 access_crm_meeting_type_sale_user crm.meeting.type.salesman model_crm_meeting_type base.group_sale_salesman 1 0 0 0
12 access_crm_meeting_type_manager crm.meeting.type.manager model_crm_meeting_type base.group_system 1 1 1 1
13 access_calendar_alarm_manager access_calendar_alarm_manager model_calendar_alarm_manager 1 1 1 1

View File

@ -1 +1,2 @@
import res_config
import google_calendar

Binary file not shown.

View File

@ -31,10 +31,13 @@ The module adds the possibility to synchronize Google Calendar with OpenERP
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['google_base_account','base_calendar'],
'css': ['static/src/css/*.css'],
'js': ['static/src/js/*.js'],
'qweb': ['static/src/xml/*.xml'],
'data': [
'google_calendar_data.xml',
'res_config_view.xml',
'security/ir.model.access.csv',
],
'demo': [],
'installable': True,

View File

@ -0,0 +1,53 @@
from openerp.osv import fields, osv
class calendar_config_settings(osv.osv_memory):
_name = 'calendar.config.settings'
_inherit = 'res.config.settings'
_columns = {
'google_cal_sync': fields.boolean("Show tutorial to know how to get my 'Client ID' and my 'Client Secret'"),
'cal_client_id': fields.char("Client_id"),
'cal_client_secret': fields.char("Client_key"),
}
def set_calset(self,cr,uid,ids,context=None) :
params = self.pool.get('ir.config_parameter')
me = self.browse(cr,uid,ids[0],context=context)
#new_val = dict(cal_client_id=me.cal_client_id,cal_client_secret=me.cal_client_secret)
new_val_id = {
'key' : 'google_calendar_client_id',
'value' : me.cal_client_id
}
new_val_secret = {
'key' : 'google_calendar_client_secret',
'value' : me.cal_client_secret
}
exist_id = params.search(cr,uid,[('key','=','google_calendar_client_id')],context=context)
exist_secret = params.search(cr,uid,[('key','=','google_calendar_client_secret')],context=context)
if exist_id:
params.write(cr,uid,exist_id[0],new_val_id,context=context)
else:
params.create(cr,uid,new_val_id,context=context)
if exist_secret:
params.write(cr,uid,exist_secret[0],new_val_secret,context=context)
else:
params.create(cr,uid,new_val_secret,context=context)
def get_default_all(self,cr,uid,ids,context=None):
params = self.pool.get('ir.config_parameter')
cal_client_id = params.get_param(cr, uid, 'google_calendar_client_id',default='',context=context)
cal_client_secret = params.get_param(cr, uid, 'google_calendar_client_secret',default='',context=context)
return dict(cal_client_id=cal_client_id,cal_client_secret=cal_client_secret)

Binary file not shown.

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="calendar_config_settings" model="ir.ui.view">
<field name="name">Calendar settings</field>
<field name="model">calendar.config.settings</field>
<field name="arch" type="xml">
<form string="Configure your Gmail" version="7.0" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
or
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
</header>
<separator string="Google synchronization Settings"/>
<div>
<group>
<div>
<label for="google_cal_sync"/>
<field name="google_cal_sync" class="oe_inline"/>
<div>
<div attrs="{'invisible':[('google_cal_sync','=',False)]}">
<br/><h2>To setup the signin process with Google, first you have to perform the following steps</h2>
<ul>
<li> Connect on your google account and go to <a href='https://cloud.google.com/console' target='_blank'>https://cloud.google.com/console</a> </li>
<li>
Click on <b>"Create Project"</b> and enter a project name and change your id if you want. Don't forget to accept the Terms of Services
<br/><img src='/google_calendar/static/src/img/setup_01.png' class='calendar_img_tuto'/>
<br/><img src='/google_calendar/static/src/img/setup_02.png' class='calendar_img_tuto'/>
</li>
<li> In the menu on left side, select the sub menu APIs (from menu APIs and auth) and activate <b>"Calendar API"</b> by clicking on button "OFF".
<br/> You will need to accept again the "Google APIs Terms of services" and "Calendar API Terms of service"
<br/> When it's done, check that the button of "Calendar API" is well in green and with text "ON"
<br/> <img src='/google_calendar/static/src/img/setup_03.png' class='calendar_img_tuto'/>
<br/> <img src='/google_calendar/static/src/img/setup_04.png' class='calendar_img_tuto'/>
<br/> <img src='/google_calendar/static/src/img/setup_05.png' class='calendar_img_tuto'/>
</li>
<li>
In the menu on left side, select the sub menu <b>'Registered apps'</b> (from menu APIs and auth) and click on button "Register APP".
<br/> Fill in the Name of application and check that the platform is well on "Web Application" before to click on "Register"
<br/> <img src='/google_calendar/static/src/img/setup_06.png' class='calendar_img_tuto'/>
<br/> <img src='/google_calendar/static/src/img/setup_07.png' class='calendar_img_tuto'/>
</li>
<li>
Now, you can click on <b>"OAuth 2.0 Client ID"</b> and see your <i>Client ID</i> and your <i>Client Secret</i>.
<br/>That's these both informations that you need to insert in the 2 fields below !
<br/> <img src='/google_calendar/static/src/img/setup_08.png' class='calendar_img_tuto'/>
</li>
<li>
Remark : You can, if you want, personalize the consent screen that yours users will seen by clicking also in the left menu on "Consent Screen".
</li>
</ul>
</div>
</div>
</div>
</group>
<group>
<div>
<label for="cal_client_id" string="Google Client ID" />
<field name="cal_client_id" class="oe_inline"/>
</div>
</group>
<group>
<div>
<label for="cal_client_secret" string="Google Client Secret"/>
<field name="cal_client_secret" class="oe_inline"/>
</div>
</group>
</div>
</form>
</field>
</record>
<record id="action_config_settings" model="ir.actions.act_window">
<field name="name">Synchronization</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">calendar.config.settings</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem id="menu_calendar_config_settings" parent="base_calendar.menu_calendar_configuration" action="action_config_settings" groups="base.group_no_one"/>
</data>
</openerp>

View File

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_google_calendar,access_google_calendar,model_google_calendar,,1,0,0,0
access_google_calendar_all,access_google_calendar,model_google_calendar,base.group_system,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_google_calendar access_google_calendar model_google_calendar 1 0 0 0
3 access_google_calendar_all access_google_calendar model_google_calendar base.group_system 1 1 1 1

View File

@ -2,3 +2,9 @@
.openerp .oe_cal_sync_button {
margin: 20 0 20 0;
}
img.calendar_img_tuto {
margin-left : 50px;
margin-bottom : 10px;
border: 2px solid grey;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB